Bugs item #856623, was opened at 2003-12-08 19:15 Message generated for change (Comment added) made by nnorwitz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=856623&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Resolution: Works For Me Priority: 5 Submitted By: Tim McLennan (timmcl) Assigned to: Neal Norwitz (nnorwitz) 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) ---------------------------------------------------------------------- >Comment By: Neal Norwitz (nnorwitz) Date: 2005-12-18 19:45 Message: Logged In: YES user_id=33168 Assuming this is fixed. ---------------------------------------------------------------------- Comment By: Neal Norwitz (nnorwitz) Date: 2005-10-01 23:59 Message: Logged In: YES user_id=33168 I don't think this is still a bug any longer. new.function() seems to require closure be passed in if the function has cell variables. When I disassemble new_code_object, I get the same as the original. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=856623&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com