[ python-Bugs-856623 ] Erroneous code objects created with PyCode_New

SourceForge.net noreply at sourceforge.net
Mon Dec 8 22:15:01 EST 2003


Bugs item #856623, was opened at 2003-12-09 16:15
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=856623&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Tim McLennan (timmcl)
Assigned to: Nobody/Anonymous (nobody)
Summary: Erroneous code objects created with PyCode_New

Initial Comment:
If you copy a code object by calling say new.code with
just the members of an existing code object with
free/cell variables - such as the following nested example:

def null():
    return None

def wrapfunc(func):
    def _inner(*args):
       return func(*args)
    return _inner

wrapped = wrapfunc(null)

code_object = wrapped.func_code

new_code_object = new.code(<  code_object  >)


then the new_code_object will not have had its
free/cell vars removed and will thus not disassemble
correctly.  Furthermore 
if you create a function out of it, then calling the
function will raise - 
SystemError:
R:Python23srcPython-2.3.2Objectscellobject.c:
22: bad argument to internal function

Looking at the code in PyCode_New I can't see why this
should happen.

(Bug noticed on Python 2.3.2 on windows)

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

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



More information about the Python-bugs-list mailing list