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

2018-11-23 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +9931
stage:  -> patch review

___
Python tracker 

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



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

2018-11-22 Thread Danish Prakash


Danish Prakash  added the comment:

Sorry for bumping this thread but Victor, could you please share your inputs on 
this if you have the time for it, thanks.

--

___
Python tracker 

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



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

2018-10-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

>> 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.

> Karthikeyan, do you happen to have a use case where this might come into 
> action?

I don't have a use case in mind. The comment was that returning '-s -E -I' 
would need the helper function used in the test to be changed.

Thanks

--

___
Python tracker 

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



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

2018-10-07 Thread Danish Prakash


Danish Prakash  added the comment:

You're right Karthikeyan, although I personally think that returning ['-s', 
'-E', '-I'] should be a plausible solution here since it has been stated 
explicitly that it implies '-s' and '-E' but I'm still waiting for what Victor 
has to say on this. 

> 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.

Karthikeyan, do you happen to have a use case where this might come into action?

--

___
Python tracker 

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



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

2018-10-07 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> From what I understand, this can be done in one of two ways. First, we could 
> edit 
> https://github.com/python/cpython/blob/ad73a9cf97770023665a1bb1c6390a3c99478139/Modules/main.c#L430
>  and not incrementing -s and -E. But I believe this would have consequences 
> that I'm unable to think of right now, so I'd like some inputs on this. 

As in the docs for -I it implies -s and -E so removing the increment is not a 
good solution in my opinion and will break code. 

I don't know how this can be handled since -I sets -s and -E implicitly and 
_args_from_interpreted_flags just looks for the set flag. This could also get a 
little complex if we remove -s and -E based on -I since one might pass -I and 
-s. Maybe we can do an intersection of the command line arguments passes and 
the set bits in _args_from_interpreted_flags so that only -I remains? Victor 
prefers -I only and maybe has an approach to solve this?

--

___
Python tracker 

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



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

2018-10-07 Thread Danish Prakash


Danish Prakash  added the comment:

> I expect to get: ['-I'] instead of ['-s', '-E', '-I']

>From what I understand, this can be done in one of two ways. First, we could 
>edit 
>https://github.com/python/cpython/blob/ad73a9cf97770023665a1bb1c6390a3c99478139/Modules/main.c#L430
> and not incrementing -s and -E. But I believe this would have consequences 
>that I'm unable to think of right now, so I'd like some inputs on this. 

Secondly, we could handle this condition in `_args_from_interpreted_flags()` 
itself but that might be looked upon as bad practice.

--

___
Python tracker 

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



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

2018-10-04 Thread Danish Prakash


Danish Prakash  added the comment:

Linking this[1] here in case someone else stumbles upon this thread. I've 
created an issue and a PR for the documentation issue regarding the absence of 
-I flag from the sys.flags table which came into picture from the discussions 
in this thread.

[1]: https://bugs.python.org/issue34901

--

___
Python tracker 

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



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

2018-10-02 Thread Danish Prakash


Danish Prakash  added the comment:

Thank you Karthikeyan, I'm going to take care of both of these issues.

--

___
Python tracker 

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



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

2018-10-02 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> Thanks for bringing this up Karthikeyan, however, could there be another 
> reason why -I would be left out. Also, have you filed an issue for this?

I couldn't see any related issue for this though the table was changed in 3.7.0

> Also, Victor and Karthikeyan, since this issue has been categorized as an 
> easy issue, I would like to fix this if none of you have started working on 
> this.

I am not working on this. Feel free to pick it up.

--

___
Python tracker 

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



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

2018-10-02 Thread Danish Prakash


Danish Prakash  added the comment:

> With respect to documentation I was talking about '-I' not being documented 
> in the table at https://docs.python.org/3.7/library/sys.html#sys.flags though 
> it's present in the C code and in sys.flags.isolated.

Thanks for bringing this up Karthikeyan, however, could there be another reason 
why -I would be left out. Also, have you filed an issue for this?


Also, Victor and Karthikeyan, since this issue has been categorized as an easy 
issue, I would like to fix this if none of you have started working on this.

--
nosy: +danishprakash

___
Python tracker 

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



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

2018-10-01 Thread STINNER Victor


STINNER Victor  added the comment:

> ./python.exe -I -c 'import subprocess; 
> print(subprocess._args_from_interpreter_flags())'
> ['-s', '-E', '-I']

This looks wrong, I would prefer to only get ['-I'].

--

___
Python tracker 

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



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

2018-10-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks Victor for the details. 

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

With respect to documentation I was talking about '-I' not being documented in 
the table at https://docs.python.org/3.7/library/sys.html#sys.flags though it's 
present in the C code and in sys.flags.isolated.

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

'-I' also implies '-s -E' and hence adding isolated to 
args_from_interpreter_flags will also return ['-s', '-E', '-I'] as output and 
hence I suggested modifying the comparison logic.

# Since '-I' implies '-s' and '-E' those flags are also set returning '-s -E -I'

./python.exe --help | rg '\-I'
-I : isolate Python from the user's environment (implies -E and -s)

./python.exe -I -c 'import sys; print(sys.flags)'
sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=1, no_site=0, ignore_environment=1, verbose=0, bytes_warning=0, 
quiet=0, hash_randomization=1, isolated=1, dev_mode=False, utf8_mode=0)

# patching args_from_interpreter_flags to support '-I' would return below

./python.exe -I -c 'import subprocess; 
print(subprocess._args_from_interpreter_flags())'
['-s', '-E', '-I']


Thanks

--

___
Python tracker 

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



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

2018-10-01 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +easy
title: support.args_from_interpreter_flags() doesn't inherit -I (isolated) flag 
-> [EASY] support.args_from_interpreter_flags() doesn't inherit -I (isolated) 
flag

___
Python tracker 

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