[Patches] [ python-Patches-1638243 ] compiler.pycodegen causes crashes when compiling 'with'
SourceForge.net
noreply at sourceforge.net
Sat Jan 27 18:43:16 CET 2007
Patches item #1638243, was opened at 2007-01-18 03:52
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1638243&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: Parser/Compiler
Group: Python 2.5
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: kirat (kirat)
>Assigned to: Georg Brandl (gbrandl)
Summary: compiler.pycodegen causes crashes when compiling 'with'
Initial Comment:
The compiler package in the python library is missing a LOAD/DELETE just before the WITH_CLEANUP instruction.
Also transformer isn't creating the with_var as an assignment.
So the following little code snippet will crash if you compile and run it with compiler.compile()
class TrivialContext:
def __enter__(self): return self
def __exit__(self,*exc_info): pass
def f():
with TrivialContext() as tc:
return 1
f()
The fix is just a few lines. I'm enclosing a patch against the python 2.5 source.
I've also added the above as a test case to the test_compiler.py file.
regards,
-Kirat
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2007-01-27 17:43
Message:
Logged In: YES
user_id=849994
Originator: NO
Thanks for the patch, this is fixed now in rev. 53575, 53576 (2.5).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1638243&group_id=5470
More information about the Patches
mailing list