Author jmfauth
Recipients amaury.forgeotdarc, benjamin.peterson, brett.cannon, jmfauth, sjmachin, vstinner
Date 2009-03-25.09:54:39
SpamBayes Score 3.61227e-09
Marked as misclassified No
Message-id <1237974882.95.0.904832877135.issue4626@psf.upfronthosting.co.za>
In-reply-to
Content
When I was preparing some test examples to be submitted here.
I noticed the module codeop.py used by the InteractiveInterpreter,
does not like byte strings very much.

IDLE, Python 3.0.1, winxp sp2

>>> source = b'print(999)'
>>> compile(source, '<in>', 'exec')
<code object <module> at 0x00AA5CC8, file "<in>", line 1>
>>> r = compile(source, '<in>', 'exec')
>>> exec(r)
999
>>> from code import InteractiveInterpreter
>>> ii = InteractiveInterpreter()
>>> ii.runsource(source)
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    ii.runsource(source)
  File "C:\Python30\lib\code.py", line 63, in runsource
    code = self.compile(source, filename, symbol)
  File "C:\Python30\lib\codeop.py", line 168, in __call__
    return _maybe_compile(self.compiler, source, filename, symbol)
  File "C:\Python30\lib\codeop.py", line 70, in _maybe_compile
    for line in source.split("\n"):
TypeError: Type str doesn't support the buffer API
>>> 
>>> source = 'print(999)'
>>> ii.runsource(source)
999
False
History
Date User Action Args
2009-03-25 09:54:44jmfauthsetrecipients: + jmfauth, brett.cannon, sjmachin, amaury.forgeotdarc, vstinner, benjamin.peterson
2009-03-25 09:54:42jmfauthsetmessageid: <1237974882.95.0.904832877135.issue4626@psf.upfronthosting.co.za>
2009-03-25 09:54:41jmfauthlinkissue4626 messages
2009-03-25 09:54:40jmfauthcreate