This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author altendky
Recipients altendky
Date 2018-02-15.16:39:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1518712745.86.0.467229070634.issue32852@psf.upfronthosting.co.za>
In-reply-to
Content
Normally sys.argv is a list but when using the trace module sys.argv gets changed to a tuple.  In my case this caused an issue with running an entry point due to the line:

  sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])

When researching I found:
  https://stackoverflow.com/questions/47688568/trace-sys-argv-args-typeerror-tuple-object-does-not-support-item-assig

They point out where trace assigns a tuple to sys.argv.
  https://github.com/python/cpython/blob/master/Lib/trace.py#L708


I'll see what I can do to put together a quick patch.


$ cat t.py
import sys

print(sys.version)

print(type(sys.argv))
$ /home/altendky/.pyenv/versions/3.7.0a2/bin/python t.py
3.7.0a2 (default, Feb 15 2018, 11:20:36) 
[GCC 6.3.0 20170516]
<class 'list'>
$ /home/altendky/.pyenv/versions/3.7.0a2/bin/python -m trace --trace t.py
 --- modulename: t, funcname: <module>
t.py(1): import sys
t.py(3): print(sys.version)
3.7.0a2 (default, Feb 15 2018, 11:20:36) 
[GCC 6.3.0 20170516]
t.py(5): print(type(sys.argv))
<class 'tuple'>
 --- modulename: trace, funcname: _unsettrace
trace.py(71):     sys.settrace(None)
History
Date User Action Args
2018-02-15 16:39:05altendkysetrecipients: + altendky
2018-02-15 16:39:05altendkysetmessageid: <1518712745.86.0.467229070634.issue32852@psf.upfronthosting.co.za>
2018-02-15 16:39:05altendkylinkissue32852 messages
2018-02-15 16:39:05altendkycreate