A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2000-July/006919.html below:

[Python-Dev] Preventing 1.5 extensions crashing under 1.6/2.0 Python

[Python-Dev] Preventing 1.5 extensions crashing under 1.6/2.0 Python [Python-Dev] Preventing 1.5 extensions crashing under 1.6/2.0 PythonBarry Scott barry@scottb.demon.co.uk
Tue, 18 Jul 2000 23:15:10 +0100
mark commenting on Gordon commenting on Barry...

> If we are asking them to change their code, can we investigate whether
> asking them to insert a simple:
> 
> if (!Py_IsInitialized())
>   Py_FatalError("Bad Python version"); /* Never returns */
>
> works OK?  I believe it will, as long as Python's fatal error handler
> doesnt make thread-state assumptions.

	I think this code will crash.

	1. Python20.dll loads and is initialised.
	2. python20.dll loads old_extension.pyd
	3. old_extension.pyd causes python15.dll to load

	At this point we have two copies of python in memory.

	4. old_extension.pyd calls Py_IsInitialized() which is bound
	   to the function in python15.dll.
	5. FALSE is return as python15.dll has not been initialised.
	6. Py_FatalError which is bound in python15.dll is called.
	   May well crash, certainly does not communicate to python20.dll

	You could just:

if (!Py_IsInitialized())
     return;

	Which prevents the module being created and hence gets an already
	implemented error message.

	The down side is that does not work for .PYD that have already been
	shipped for 1.5.

	Also if we wish to solve this class of problem for unix as well this
	does not work.

		Barry




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4