Message308310
Christian Heimes, author of the -I option (isolated mode), asked me to open an issue to check if the following behaviour is correct (safe in term of security).
"python3 directory" inserts "directory" at sys.path[0], even in isolated mode. Example:
---
vstinner@apu$ mkdir directory
vstinner@apu$ echo "import pprint, sys; pprint.pprint(sys.path)" > directory/__main__.py
vstinner@apu$ python3 directory
['directory',
'/usr/lib64/python3.6',
...]
# Same behaviour with -I
vstinner@apu$ python3 -I directory
['directory',
'/usr/lib64/python3.6',
...]
---
Same behaviour for a ZIP file:
---
vstinner@apu$ cd directory/
vstinner@apu$ zip ../testzip.zp __main__.py
adding: __main__.py (deflated 20%)
vstinner@apu$ cd ..
vstinner@apu$ python3 testzip.zip
python3: can't open file 'testzip.zip': [Errno 2] No such file or directory
vstinner@apu$ mv testzip.zp testzip.zip
'testzip.zp' -> 'testzip.zip'
vstinner@apu$ python3 testzip.zip
['testzip.zip',
'/usr/lib64/python3.6',
...]
# Same behaviour with -I
vstinner@apu$ python3 -I testzip.zip
['testzip.zip',
'/usr/lib64/python3.6',
...]
---
The -I option:
https://docs.python.org/dev/using/cmdline.html#id2 |
|
Date |
User |
Action |
Args |
2017-12-14 16:09:15 | vstinner | set | recipients:
+ vstinner, steve.dower |
2017-12-14 16:09:15 | vstinner | set | messageid: <1513267755.86.0.213398074469.issue32324@psf.upfronthosting.co.za> |
2017-12-14 16:09:15 | vstinner | link | issue32324 messages |
2017-12-14 16:09:15 | vstinner | create | |
|