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 christian.heimes
Recipients Karemir, christian.heimes
Date 2007-11-21.04:01:07
SpamBayes Score 0.0027295584
Marked as misclassified No
Message-id <1195617668.42.0.371766270469.issue1306@psf.upfronthosting.co.za>
In-reply-to
Content
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]
History
Date User Action Args
2007-11-21 04:01:08christian.heimessetspambayes_score: 0.00272956 -> 0.0027295584
recipients: + christian.heimes, Karemir
2007-11-21 04:01:08christian.heimessetspambayes_score: 0.00272956 -> 0.00272956
messageid: <1195617668.42.0.371766270469.issue1306@psf.upfronthosting.co.za>
2007-11-21 04:01:08christian.heimeslinkissue1306 messages
2007-11-21 04:01:07christian.heimescreate