Bruno Dupuis added the comment:

This first patch spots the issue, but doesn't solve it if the bytecode of the 
function is > 32700 (see PyCode_Optimize comment). However with this patch, we 
get the LOAD_CONST anytime for None, True and False.

There is two questions :

1- is it safe to strip all the code after RETURN_VALUE as the patch does?

2- to correct this bug, we will need a deep refactoring of PyCode_Optimize (so 
that it accepts any code length).

The other way, is not to rely on PyCode_Optimize to compile return 
None/True/False, but do modifictations in the compiler itself. This must be the 
right way to do this, but it's far beyond my C skills and python core knowledge.

----------
keywords: +patch
Added file: http://bugs.python.org/file28217/16619-1.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16619>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to