[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Guido van Rossum


Change by Guido van Rossum :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread STINNER Victor


STINNER Victor  added the comment:

See also https://docs.python.org/dev/library/sys.html#sys.unraisablehook

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Christian Heimes


Christian Heimes  added the comment:

The exceptions are ignored (Exception ignored in) on shutdown and therefore 
don't cause the interpreter to fail with an error code. Unraisable exceptions 
typically occur when the interpreter is mostly shut down and garbage 
collection, import or atexit hook is triggered as a side-effect.

--
nosy: +christian.heimes

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Xinmeng Xia


Change by Xinmeng Xia :


--
type:  -> compile error

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42858] Incorrect return value for os.system() in recognizing import error

2021-01-07 Thread Xinmeng Xia


New submission from Xinmeng Xia :

Running attached "test_zipfile.py" on Python 3.10 will lead to the following 
error messages:

Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
401, in temp_dir
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
358, in rmtree
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
322, in _rmtree
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: 
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
401, in temp_dir
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
358, in rmtree
  File "/usr/local/python310/lib/python3.10/test/support/os_helper.py", line 
322, in _rmtree
ImportError: sys.meta_path is None, Python is likely shutting down


However, if we run this program with os.system, the return value is 0 instead 
of 256. 0 represent no fails in this running! This is obviously incorrect.

Reproduce:
=
import os
scode = os.system('python310  test_zipfile.py')
print("The system code of this execution is:", scode)
=

The expected output: "The system code of this execution is: 256"
The actual output: "The system code of this execution is: 0"

Version info:
>>python310 -V
Python 3.10.0a2
>>uname -v
16.04.1-Ubuntu SMP Fri Sep 13 09:56:18 UTC 2019

--
components: Library (Lib)
files: test_zipfile.py
messages: 384582
nosy: xxm
priority: normal
severity: normal
status: open
title: Incorrect return value for os.system() in recognizing import error
versions: Python 3.10
Added file: https://bugs.python.org/file49726/test_zipfile.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com