Christian Heimes added the comment:
Python 3.0 suffers from an problem with reinitialization but I can't
reproduce the bug with the release branch of 2.5. Python 2.6 also does
fine but leaks some references.
// reinit_test.c
#include "Python.h"
#define ROUNDS 5
int main(void) {
int i;
for (i=0; i < ROUNDS; i++) {
printf("round %d\n", i+1);
Py_Initialize();
Py_Finalize();
}
return 0;
}
gcc -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -IInclude -I. -pthread
-Xlinker -lpthread -ldl -lutil -lm -export-dynamic -o reinit_test
reinit_test.c libpython2.5.a
Python 3.0
----------
./reinit_test
round 1
[23832 refs]
round 2
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "/usr/local/lib/python3.0/encodings/__init__.py", line 32, in
<module>
from . import aliases
ValueError: Cannot encode path item
Aborted
Python 2.6
----------
$ ./reinit_test
round 1
[7349 refs]
round 2
[7393 refs]
round 3
[7428 refs]
round 4
[7463 refs]
round 5
[7498 refs]
Python 2.5
----------
$ ./reinit_test
round 1
[7309 refs]
round 2
[7349 refs]
round 3
[7380 refs]
round 4
[7411 refs]
round 5
[7442 refs]
----------
keywords: +py3k
nosy: +tiran
priority: -> normal
severity: urgent -> normal
versions: +Python 2.6, Python 3.0
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1306>
__________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com