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

STINNER Victor report at bugs.python.org
Mon Oct 1 06:21:45 EDT 2018


STINNER Victor <vstinner at redhat.com> 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 <report at bugs.python.org>
<https://bugs.python.org/issue34812>
_______________________________________


More information about the Python-bugs-list mailing list