[Patches] [ python-Patches-1004088 ] big code objects (>64K) may be optimized incorrectly

SourceForge.net noreply at sourceforge.net
Thu Aug 5 19:53:41 CEST 2004


Patches item #1004088, was opened at 2004-08-05 13:46
Message generated for change (Comment added) made by tim_one
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1004088&group_id=5470

Category: Parser/Compiler
Group: Python 2.3
Status: Open
Resolution: None
>Priority: 7
Submitted By: Cezary Biernacki (cezary)
>Assigned to: Raymond Hettinger (rhettinger)
Summary: big code objects (>64K) may be optimized incorrectly

Initial Comment:
Large functions with size of a bytecode bigger than
65535 bytes may be incorrectly optimized by
"optimize_code" in "Python/compile.c". Optimalization
happens automaticaly during loading from *.pyc and
cannot be disabled. Codes loaded directly from source
(*.py) are not optimalized and not affected by this bug.

One of task of "optimize_code" is to eliminate
"chained" jumps  (when one of jumps points directly to
unconditional jump). Problems occurs when a first jump
opcode points to JUMP_FORWARD, which target is after
64K boundary. This target adress is copied as absolute
address of the first jump modulo 2**16.

This bug can lead to different symptoms during
execution of a code. You can get an "unknown opcode"
error, but  sometimes results can be unpredicable.

This problem appears in Python 2.3 (tested) and
possibly in 2.4 (alfa). 

Attached scripts generates large functions a writes
disassebles before and after optimalization. You will
find, that some adresses after optimalization are bad. 
 


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2004-08-05 13:53

Message:
Logged In: YES 
user_id=31435

Raised priority and assigned to Raymond.  I haven't verified 
the claim, but it sounds more plausible than not, and is a 
critical bug if so.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1004088&group_id=5470


More information about the Patches mailing list