[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2020-05-14 Thread STINNER Victor
STINNER Victor added the comment: > I agree with @p-ganssle, If exist some problem on initialize Python > interpreter it would be great if it return a non-zero status and avoid an > abort() Since Python 3.8 (PEP 587), Python no longer call abort() on initialization error. $ echo bug >

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Emmanuel Arias
Emmanuel Arias added the comment: > Otherwise I'd say it would be nice to refactor in such a way that avoids the > core dump when the problem is on the Python side I agree with @p-ganssle, If exist some problem on initialize Python interpreter it would be great if it return a non-zero

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Guido van Rossum
Change by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Paul Ganssle
Paul Ganssle added the comment: > @Guido, I recall a while back you explained the value of adding CWD to > sys.path. Would you mind providing some insight here I think bpo-35971 or bpo-13475 are better places to discuss that, because this issue doesn't require CWD to be in the path. You

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Eric Snow
Eric Snow added the comment: @Guido, I recall a while back you explained the value of adding CWD to sys.path. Would you mind providing some insight here? -- nosy: +gvanrossum ___ Python tracker

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Eric Snow
Eric Snow added the comment: related: issue #13475 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Eric Snow
Eric Snow added the comment: On Tue, Feb 12, 2019 at 3:57 AM STINNER Victor wrote: > A long term solution would to enable -I behavior by default: don't add the > current directory to sys.path when using -c CMD. >From what I can recall, it was a conscious decision to include CWD in

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread STINNER Victor
STINNER Victor added the comment: See also bpo-35971: "Documentation should warn about code injection from current working directory" which discuss changing the default behavior. -- ___ Python tracker

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Paul Ganssle
Paul Ganssle added the comment: > One enhancement of this new API is that it now reports the name of the C > function which causes the error. The initial bug report says "Fatal Python > error: init_sys_streams: can't initialize sys standard streams": init_sys_streams() function raised the

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread STINNER Victor
STINNER Victor added the comment: A workaround is the usage of -I option: vstinner@apu$ PYTHONPATH=: python3 -c "" Fatal Python error: init_sys_streams: can't initialize sys standard streams Traceback (most recent call last): File "/usr/lib64/python3.7/io.py", line 52, in File

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread STINNER Victor
STINNER Victor added the comment: Last year, I reworked Python initialization to introduce a new _PyInitError structure which allows to report a failure to the caller of a function instead of calling directly Py_FatalError() which always call abort() immediately. _PyInitError allows to

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-12 Thread Emmanuel Arias
Emmanuel Arias added the comment: Hi, The reason of the aborted(core dump) of the interpreter is because when the init process was wrong, the ```_Py_NO_RETURN fatal_error()``` call and abort() So, I change it for a exit(status) to avoid break the interpreter (I attach a patch) What do

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Sorry by previous reports I was talking about some of the issues where the installers were not correct though I couldn't find the issue at the moment. I just presented it as a data point where some necessary modules that cannot be imported could

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-11 Thread Paul Ganssle
Paul Ganssle added the comment: @Karthikeyan I would certainly consider this a duplicate of the encodings bug/behavior that you demonstrate. I don't see an existing bug on the tracker for it, though. I think it's pretty clear that the interpreter needs to fail, but it seems to *crash*

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I hope there are certain modules that CPython interpreter expects to load properly. There were some cases in the past where encodings module caused the interpreter to crash. A similar scenario. ➜ cpython git:(master) echo "raise Exception('a')" >

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-11 Thread Paul Ganssle
Paul Ganssle added the comment: Tested with 3.6 and 2.7 - core dump on 3.6, no core dump on 2.7. The crash on 2.7 goes through a different path, it goes site.py > os.py >= UserDict.py > _abcoll.py > abc.py. That may account for why it's not crashing the interpreter itself. --

[issue35969] Interpreter crashes with "can't initialize init_sys_streams" when abc fails to import

2019-02-11 Thread Paul Ganssle
New submission from Paul Ganssle : Just noticed this (tested on Python 3.7 and 3.8): mkdir /tmp/demo cd /tmp/demo cat << EOF > abc.py raise Exception("Hi") EOF PYTHONPATH=: python -c "" This will crash the interpreter with: Fatal Python error: init_sys_streams: