STINNER Victor added the comment:
I lost track of this issue and my PEP 490 was more and less rejected, so I just
close this issue.
I was decided that chaining or not exceptions should be done on a case by case
basis.
--
resolution: -> out of date
stage: -> resolved
status: open ->
Changes by STINNER Victor victor.stin...@gmail.com:
--
versions: +Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23763
___
___
Serhiy Storchaka added the comment:
I think it would be safer to defer automatically chaining exceptions to 3.6.
After releasing 3.5 we can got reports about exceptions ignored by mistake.
After fixing all bugs not covered by the testsuite, we could try automatically
chain exceptions. May be
STINNER Victor added the comment:
Le mercredi 25 mars 2015, Serhiy Storchaka rep...@bugs.python.org a
écrit :
I think it would be safer to defer automatically chaining exceptions to
3.6. After releasing 3.5 we can got reports about exceptions ignored by
mistake.
Hum, what change can ignore
New submission from STINNER Victor:
In Python 3, it becomes possible to chain two exceptions. It's one of the
killer feature of Python 3, it helps debugging.
In Python, exceptions are chained by default. Example:
try:
raise TypeError(old message)
except TypeError:
STINNER Victor added the comment:
For the next step, I propose to explicitly clear the current exception before
raising a new exception.
Attached pyerr_match_clear.patch implements this. It's only a work-in-progress.
I prefer to get feedback on the patch before finishing it.
The patch
STINNER Victor added the comment:
While working on the PEP 475, I modified _Py_fopen_obj() to raise the OSError
(instead of raising the exception from the call site). The zipimport uses
_Py_fopen_obj() but it didn't raise OSError, only ZipImportError. I modified
the zipimport module to raise
STINNER Victor added the comment:
See also issue #21715: Chaining exceptions at C level. The changeset
9af21752ea2a added the new _PyErr_ChainExceptions() function.
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
pyerr_match_assertion.patch: Modify PyErr_ExceptionMatches() to raise an
exception if it is called with no exception set.
This patch can be used to ensure that pyerr_match_clear.patch doesn't introduce
regression.
Example:
-
STINNER Victor added the comment:
pyerr_match_clear-2.patch: Updated patch, more complete (I also removed the
assertions, I only added to debug).
Since my patch makes assumption on which exception is expected, it can change
the behaviour of functions if I forgot a different exception which
STINNER Victor added the comment:
New issue #23770: Rework of exceptions are handled in the parser module (in
validate_repeating_list()) to fix error handling in the parser module.
--
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
Sorry, I had issues with my local repository. Third try to upload
pyerr_match_clear-2.patch for Rietveld.
--
Added file: http://bugs.python.org/file38680/pyerr_match_clear-2.patch
___
Python tracker
Changes by STINNER Victor victor.stin...@gmail.com:
Removed file: http://bugs.python.org/file38677/pyerr_match_clear-2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23763
___
STINNER Victor added the comment:
Oh, I had a private local commit when I generated pyerr_match_clear-2.patch and
so Rietveld failed to find the branch. I regenerated the patch.
--
Added file: http://bugs.python.org/file38678/pyerr_match_clear-2.patch
STINNER Victor added the comment:
pyerr_chain.patch: The real patch to chain automatically exceptions when using
PyErr_*() functions.
pyerr_match_clear-2.patch hides the original exception when it is useless, too
low level like OverflowError when casting to C types, etc.
Examples without
Changes by STINNER Victor victor.stin...@gmail.com:
Removed file: http://bugs.python.org/file38678/pyerr_match_clear-2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23763
___
STINNER Victor added the comment:
pyerr_assert.patch: modify PyErr_SetObject() and PyErr_Format() to fail with an
assertion error if these functions are called with an exception set.
This patch detects where an exception is raised while another exception was
already raised (like try: ...
17 matches
Mail list logo