STINNER Victor added the comment:
@Antoine: exctests.patch looks good to me, can you commit it?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
Changes by Antoine Pitrou pit...@free.fr:
--
resolution: - fixed
stage: - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
STINNER Victor added the comment:
Thanks Antoine!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
___
Python-bugs-list mailing list
Roundup Robot added the comment:
New changeset ac43268da908 by Antoine Pitrou in branch '3.4':
Issue #23353: improve exceptions tests for generators
https://hg.python.org/cpython/rev/ac43268da908
New changeset b29342f53174 by Antoine Pitrou in branch 'default':
Issue #23353: improve exceptions
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:
--
nosy: +Arfrever
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
Roundup Robot added the comment:
New changeset 2cd6621a9fbc by Victor Stinner in branch '3.4':
Issue #23353, asyncio: Workaround CPython bug #23353
https://hg.python.org/cpython/rev/2cd6621a9fbc
--
___
Python tracker rep...@bugs.python.org
Antoine Pitrou added the comment:
Additional simple tests for test_exceptions.py.
--
Added file: http://bugs.python.org/file37943/exctests.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
Serhiy Storchaka added the comment:
If you need non-normalized exception for testing, a NameError generated by
interpreter is not normalized.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
Antoine Pitrou added the comment:
It would have been nice to wait for a review. Generator tests are already in
test_exceptions.py.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
STINNER Victor added the comment:
It would have been nice to wait for a review. Generator tests are already in
test_exceptions.py.
Sorry, I wanted to quickly push your fix to fix buildbots. I dislike being the
responsible of turning all buildbots to red...
Before working on this issue, I
STINNER Victor added the comment:
By the way: buildbots are green again, cool.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
___
STINNER Victor added the comment:
I agree that it's better to not change the behaviour of generators, backward
compatibility matters :-)
I wrote tests using my examples and I combined them with
gen_exc_state_restore.patch. I commited the changeset in Python 3.4 and 3.5.
Backporting the fix
Roundup Robot added the comment:
New changeset 4555da8c3091 by Victor Stinner in branch '3.4':
Issue #23353: Fix the exception handling of generators in PyEval_EvalFrameEx().
https://hg.python.org/cpython/rev/4555da8c3091
--
nosy: +python-dev
___
Antoine Pitrou added the comment:
I think your patch for 2.7 is wrong as was your patch for 3.x. You shouldn't
change the behaviour of sys.exc_info() in the nominal case.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
STINNER Victor added the comment:
Last major change related to generators in Python/ceval.c:
---
changeset: 47594:212a1fee6bf9
parent: 47585:b0ef00187a7e
user:Benjamin Peterson benja...@python.org
date:Wed Jun 11 15:59:43 2008 +
files: Doc/library/dis.rst
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +pitrou, serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
___
STINNER Victor added the comment:
Attached gen_exc_value_py27.patch: Patch for Python 2.7. No unit test yet.
The full test suite of trollius pass on the patched Python 2.7 and on the
patched Python 3.5. The full test suite of asyncio also pass on the patched
Python 3.5.
--
Added
STINNER Victor added the comment:
Attached gen_exc_value.patch changes how generators handle the currently
handled exception (tstate-exc_value). The patch probably lacks tests to test
the exact behaviour of sys.exc_info(). The 3 examples below can be used to
write such tests. But before
STINNER Victor added the comment:
Oh, by the way: keeping the exception after the except block is also a tricky
reference leak. In Python 3, since exceptions store their traceback, this issue
may keep a lot of objects alive too long, whereas they are expected to be
destroyed much earlier.
STINNER Victor added the comment:
See also:
* PEP 3134: Exception Chaining and Embedded Tracebacks (Python 3.0)
* Issue #3021: Lexical exception handlers (Python 3.0) -- thread:
https://mail.python.org/pipermail/python-3000/2008-May/013740.html
* PEP 380: Syntax for Delegating to a
Antoine Pitrou added the comment:
Currently, a generator inherits the currently handled exception from
the caller
This is expected, since this is how normal functions behave.
--
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
Currently, a generator inherits the currently handled exception from
the caller
This is expected, since this is how normal functions behave.
Do you see how to fix the issue without changing the behaviour?
--
Antoine Pitrou added the comment:
Attached patch fixes the test script and doesn't break any test.
--
Added file: http://bugs.python.org/file37933/gen_exc_state_restore.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
Antoine Pitrou added the comment:
Note the patch also fixes the reference leak in test_asyncio.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23353
___
24 matches
Mail list logo