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

2012-03-10 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I agree. 'deprecated' pretty much means "We do not think this is worth the 
effort of maintaining it. Don't use it unless it is already in old code."

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

Okay, so the issue is simply that the compiler module doesn't have logic for 
emitting the EXTENDED_ARGS[1] bytecode instruction to properly deal with a jump 
target that won't fit in two bytes.  Given that the compiler module is 
deprecated, I propose closing this as 'won't fix'.

[1] http://docs.python.org/library/dis.html#opcode-EXTENDED_ARG

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

D'oh.  Ignore that last message;   all it shows is that I'm stupid.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-10 Thread Mark Dickinson

Mark Dickinson  added the comment:

Interestingly, dis.dis also fails to decompile the .pyc bytecode generated by 
importing the file.  (This was after adding dummy AddUnit, MakeCustomaryToBase 
and MakeBaseToCustomary definitions to the top of the file to prevent the 
import raising an exception.)


>>> with open('small_with_error.pyc', 'r') as f:
... bytecode = f.read()
... 
>>> bytecode = bytecode[8:]
>>> dis.dis(bytecode)

<... lots of output snipped ...>

   65686 LOAD_GLOBAL 4 (4)
   65689 STOP_CODE  
   65690 STOP_CODE  
   65691 POP_JUMP_IF_TRUE 27749
   65694 BUILD_TUPLE  1140
   65697 STOP_CODE  
   65698 STOP_CODE  
   65699 STOP_CODE  
   65700 STORE_GLOBAL26482 (26482)
   65703 POP_JUMP_IF_TRUE  1652
   65706 STOP_CODE  
   65707 STOP_CODE  
   65708 STOP_CODE  
   65709 COMPARE_OP  24951
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/dis.py", line 
45, in dis
disassemble_string(x)
  File 
"/Library/Frameworks/Python.framework/Versions/7.2/lib/python2.7/dis.py", line 
147, in disassemble_string
print '(' + cmp_op[oparg] + ')',
IndexError: tuple index out of range

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-10 Thread Mark Dickinson

Mark Dickinson  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, '', 'exec')
POP_JUMP_IF_FALSE 65541
114 5 256
Traceback (most recent call last):
  File "", line 1, in 
  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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-09 Thread Jim Jewett

Jim Jewett  added the comment:

If I understood correctly, that *is* the minimal case, which suggests some sort 
of size problem. 

That said, I could not duplicate on 2.6.2, nor with py_compile.compiler in 
3.2.2; I am not currently sufficiently motivated to install another version 
just for this.

--
nosy: +Jim.Jewett

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-04 Thread Meador Inge

Changes by Meador Inge :


--
nosy: +meador.inge

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-02 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Please provide a *minimal* example that exhibits the problem. 'Minimal' means 
that if a single line is removed, the problem disappears.

--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



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

2012-03-01 Thread Fabio Menegazzo

New submission from Fabio Menegazzo :

compiler.compile fails on "if" statement in attached file.

When executing the code

compiler.compile(contents, '', 'exec')

passing the attached file contents, the following error is raised:

ValueError: chr() arg not in range(256)

This won't fail when using the builtin "compile". Also removing the "if" 
statement or any line before it, the contents are compiled successfully.

--
files: small_with_error.py
messages: 154707
nosy: menegazzobr
priority: normal
severity: normal
status: open
title: compiler.compile fails on "if" statement in attached file
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file24699/small_with_error.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com