[issue34812] support.args_from_interpreter_flags() doesn't inherit -I (isolated) flag

2018-10-01 Thread STINNER Victor


STINNER Victor  added the comment:

In the C code, sys.flags.isolated clearly documented as linked to the -I option:

static PyStructSequence_Field flags_fields[] = {
{"debug",   "-d"},
{"inspect", "-i"},
{"interactive", "-i"},
{"optimize","-O or -OO"},
{"dont_write_bytecode", "-B"},
{"no_user_site","-s"},
{"no_site", "-S"},
{"ignore_environment",  "-E"},
{"verbose", "-v"},
/* {"unbuffered",   "-u"}, */
/* {"skip_first",   "-x"}, */
{"bytes_warning",   "-b"},
{"quiet",   "-q"},
{"hash_randomization",  "-R"},
{"isolated","-I"},
{"dev_mode","-X dev"},
{"utf8_mode",   "-X utf8"},
{0}
};

> The only thing here is that '-I' returns '-s -E -I' unlike other options 
> where args can be used for comparison logic in check_options.

I expect to get:

$ python3 -I -c 'import subprocess; 
print(subprocess._args_from_interpreter_flags())'
['-I']

instead of:

['-s', '-E']

-I is different from -s -E: it also avoids to add the script directory or an 
empty string to sys.path.

--

___
Python tracker 

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



[issue34812] support.args_from_interpreter_flags() doesn't inherit -I (isolated) flag

2018-09-29 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Victor for the details. Can this be classified as an easy issue? I guess 
the fix will be as below : 

1. Add an entry for '-I' at 
https://github.com/python/cpython/blob/4b430e5f6954ef4b248e95bfb4087635dcdefc6d/Lib/subprocess.py#L260

2. Add a test for '-I' at 
https://github.com/python/cpython/blob/4b430e5f6954ef4b248e95bfb4087635dcdefc6d/Lib/test/test_support.py#L472.
 
The only thing here is that '-I' returns '-s -E -I' unlike other options where 
args can be used for comparison logic in check_options. check_options should be 
changed so that this can take given args and the expected args for comparison 
to accommodate -I. Maybe there is a better way?

Off topic : I don't know why '-I' is not documented as sys.flags.isolated at 
https://docs.python.org/3.7/library/sys.html#sys.flags . Maybe I will open up a 
separate issue for this?

--

___
Python tracker 

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



[issue34812] support.args_from_interpreter_flags() doesn't inherit -I (isolated) flag

2018-09-26 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34812] support.args_from_interpreter_flags() doesn't inherit -I (isolated) flag

2018-09-26 Thread STINNER Victor


New submission from STINNER Victor :

The support.args_from_interpreter_flags() function recreates Python command 
line arguments from sys.flags, but it omits -I (sys.flags.isolated).

Because of that, "./python -I -m test ..." behaves differently than "./python 
-I -m test -j0 ...":
https://bugs.python.org/issue28655#msg326477

--
components: Library (Lib), Tests
messages: 326478
nosy: vstinner
priority: normal
severity: normal
status: open
title: support.args_from_interpreter_flags() doesn't inherit -I (isolated) flag
versions: Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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