From: <th...@us...> - 2009-07-13 15:29:39
|
Revision: 6535 http://jython.svn.sourceforge.net/jython/?rev=6535&view=rev Author: thobes Date: 2009-07-13 15:29:30 +0000 (Mon, 13 Jul 2009) Log Message: ----------- Fixed incompatibility with CPython in the new ContextManager protocol, the evaluation order in the implementation was not as specified by PEP 343. According to PEP 343 the __exit__ attribute should be accessed and stored before the __enter__ attribute is accessed and invoked. Modified Paths: -------------- trunk/jython/src/org/python/core/ContextGuard.java Modified: trunk/jython/src/org/python/core/ContextGuard.java =================================================================== --- trunk/jython/src/org/python/core/ContextGuard.java 2009-07-12 18:14:32 UTC (rev 6534) +++ trunk/jython/src/org/python/core/ContextGuard.java 2009-07-13 15:29:30 UTC (rev 6535) @@ -11,8 +11,8 @@ private final PyObject __exit__method; private ContextGuard(PyObject manager) { + __exit__method = manager.__getattr__("__exit__"); __enter__method = manager.__getattr__("__enter__"); - __exit__method = manager.__getattr__("__exit__"); } public PyObject __enter__(ThreadState ts) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |