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 takluyver
Recipients takluyver, vstinner
Date 2015-03-09.01:21:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1425864069.02.0.403381374988.issue23615@psf.upfronthosting.co.za>
In-reply-to
Content
Issue #22599 changed tokenize.open() from using builtins.open() to having a module-level reference to _builtin_open, stored by doing _builtin_open = open. However, on reloading the module, _builtin_open is pointed to tokenize.open from the last execution of the code, breaking tokenize.open():

>>> import tokenize
>>> tokenize.open
<function open at 0x7f15b660fc80>
>>> tokenize._builtin_open
<built-in function open>
>>> import imp; imp.reload(tokenize)
<module 'tokenize' from '/home/takluyver/miniconda3/envs/py34/lib/python3.4/tokenize.py'>
>>> tokenize.open
<function open at 0x7f15b660fbf8>
>>> tokenize._builtin_open
<function open at 0x7f15b660fc80>
>>> tokenize.open('foo.py')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/takluyver/miniconda3/envs/py34/lib/python3.4/tokenize.py", line 438, in open
    buffer = _builtin_open(filename, 'rb')
TypeError: open() takes 1 positional argument but 2 were given

The actual case where I'm seeing this error is nose logging a failure in a test suite, so it's not clear what is reloading tokenize, but it appears that something is. This just started failing when our Windows test system updated to Python 3.4.3.
History
Date User Action Args
2015-03-09 01:21:09takluyversetrecipients: + takluyver, vstinner
2015-03-09 01:21:09takluyversetmessageid: <1425864069.02.0.403381374988.issue23615@psf.upfronthosting.co.za>
2015-03-09 01:21:08takluyverlinkissue23615 messages
2015-03-09 01:21:06takluyvercreate