[issue14169] compiler.compile fails on "if" statement in attached file

Mark Dickinson report at bugs.python.org
Sat Mar 10 12:52:13 CET 2012


Mark Dickinson <dickinsm at gmail.com> added the comment:

Here's the trackback I get with Python 2.7.  Look's like something's assuming that POP_JUMP_IF_FALSE target of 65541 fits in 16 bits.


Python 2.7.2 (default, Jan 13 2012, 17:11:09) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> with open('small_with_error.py') as f:
...     contents = f.read()
... 
>>> import compiler
>>> compiler.compile(contents, '<string>', 'exec')
POP_JUMP_IF_FALSE 65541
114 5 256
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/compiler/pycodegen.py", line 65, in compile
    gen.compile()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/compiler/pycodegen.py", line 117, in compile
    self.code = gen.getCode()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/compiler/pycodegen.py", line 248, in getCode
    return self.graph.getCode()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/compiler/pyassem.py", line 313, in getCode
    self.makeByteCode()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/compiler/pyassem.py", line 518, in makeByteCode
    lnotab.addCode(self.opnum[opname], lo, hi)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/compiler/pyassem.py", line 612, in addCode
    self.code.append(chr(arg))
ValueError: chr() arg not in range(256)

----------
nosy: +mark.dickinson

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14169>
_______________________________________


More information about the Python-bugs-list mailing list