[issue16619] LOAD_GLOBAL used to load `None` under certain circumstances

Bruno Dupuis report at bugs.python.org
Wed Dec 5 22:47:46 CET 2012


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 <report at bugs.python.org>
<http://bugs.python.org/issue16619>
_______________________________________


More information about the Python-bugs-list mailing list