Hello,

This concerns a known bug in the frame_setlineno() function for Python 
2.5.x and 2.6.x (maybe in earlier version too). It is not possible to use 
this function when the address or line offset are greater than 127. The 
problem comes from the lnotab variable which is typed char*, therefore 
implicitely signed char*. Any value above 127 becomes a negative number.

The fix is very simple (applied on the Python 2.6.1 version of the source 
code):

--- frameobject.c       Thu Oct 02 19:39:50 2008
+++ frameobject_fixed.c Fri Dec 05 11:27:42 2008
@@ -119,8 +119,8 @@
        line = f->f_code->co_firstlineno;
        new_lasti = -1;
        for (offset = 0; offset < lnotab_len; offset += 2) {
-               addr += lnotab[offset];
-               line += lnotab[offset+1];
+               addr += ((unsigned char*)lnotab)[offset];
+               line += ((unsigned char*)lnotab)[offset+1];
                if (line >= new_lineno) {
                        new_lasti = addr;
                        new_lineno = line;


It would be nice to fix it for Python 2.5 and above, in order to have a 
proper MSI installer for Windows.

Best regards,
Fabien Bouleau



DISCLAIMER: 
This e-mail contains proprietary information some or all of which may be 
legally privileged. It is for the intended recipient only. If an addressing or 
transmission error has misdirected this e-mail, please notify the author by 
replying to this e-mail. If you are not the intended recipient you must not 
use, disclose, distribute, copy, print, or rely on this e-mail.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to