This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pearu
Recipients
Date 2002-02-23.19:20:27
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Hi!
I have found that if two extension modules use the same
third party
library that defines a static variable, then this
static variable is shared 
in both extension modules. In real applications, this
can cause curious segmentation faults if both extension
modules are used in the same
Python script or session. Using these extension modules
in separate
session generates no problems whatsoever.
This is observed only with Python version 2.1.1 and
2.1.2.
Python 2.0 and 2.2 are free from the described
symptoms. Therefore,
it makes me argue that there are still bugs in 2.1.2
that are related to importing extension modules. I have
prepared a small example to demonstrate all this. The
example consists of 4 files: runme.py, foo.c, bar.c,
and fun.c that are attached to this report. You only
need to run runme.py.
Here are the outputs of runme.py when used with
different Python 
versions:
$ python2.0 runme.py
From foo: set_var: var=0; Doing var++
From bar: set_var: var=0; Doing var++
$ python2.1 runme.py
From foo: set_var: var=0; Doing var++
From bar: set_var: var=1; Doing var++    <- note that
var=1 was set in foo
$ python2.2 runme.py
From foo: set_var: var=0; Doing var++
From bar: set_var: var=0; Doing var++
These tests are performed on Debian Woody with
gcc-2.95.4.

I appreciate if you could suggest a fix or workaround
to extension modules that are build under Python 2.1.2,
of course only if possible.
Thanks,
	Pearu
History
Date User Action Args
2007-08-23 13:59:22adminlinkissue521854 messages
2007-08-23 13:59:22admincreate