classification
Title: PyErr_ExceptionMatches must not fail
Type: crash Stage:
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: amaury.forgeotdarc Nosy List: ajaksu2, amaury.forgeotdarc, barry, benjamin.peterson, gvanrossum, theller
Priority: release blocker Keywords: patch

Created on 2008-04-03 08:58 by theller, last changed 2008-07-31 01:47 by benjamin.peterson. This issue is now closed.

Files
File name Uploaded Description Edit
errors.diff theller, 2008-04-03 08:58
test_exceptions.diff ajaksu2, 2008-04-03 15:51
Messages (9)
msg64894 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-04-03 08:58
PyErr_ExceptionMatches must not fail, according to the docs.  So an
error code from PyObject_IsSubclass() cannot be returned.

The attached patch calls PyErr_WriteUnraisable in this case, and returns
an arbitrary value (0 was chosen in the patch).

See also issue #2534.
msg64899 - (view) Author: Daniel Diniz (ajaksu2) (Python triager) Date: 2008-04-03 15:51
The tests pass and prints the ignores. But I still see an issue:

import sys
def g():
    try:
        return g()
    except:
        return sys.exc_info()
>>> g()
(<type 'exceptions.RuntimeError'>, 'maximum recursion depth exceeded
while calling a Python object', <traceback object at 0xb7d3d75c>)
>>> import sys
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: maximum recursion depth exceeded

Then, I can raise that RuntimeError and clear things:

>>> sys.excepthook(*g())
Traceback (most recent call last):
  File "<stdin>", line 3, in g
RuntimeError: maximum recursion depth exceeded while calling a Python object
>>> import sys
>>> 

The attached patch adds a test for this condition, I hope someone more
test-savvy than I can review it.
msg64921 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-04-04 08:17
Daniel, IMO you've found a separate bug.  I added it as issue #2548.
msg68003 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2008-06-11 18:09
This is a bug, not a new feature so it's not release critical for the
first alphas.
msg69486 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-07-09 21:10
FWIW some comments by Amaury are here:
http://codereview.appspot.com/483
msg70418 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2008-07-30 04:19
Ping? Anyone cares about this?
msg70420 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-07-30 09:38
I am working on Thomas' patch, plus tests.
msg70450 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-07-31 01:21
Committed r65320 in trunk.
I'll close the issue after it is merged into py3k.
msg70452 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2008-07-31 01:47
I just merged it.
History
Date User Action Args
2008-07-31 01:47:25benjamin.petersonsetstatus: pending -> closed
nosy: + benjamin.peterson
messages: + msg70452
keywords: patch, patch
2008-07-31 01:21:12amaury.forgeotdarcsetstatus: open -> pending
resolution: fixed
messages: + msg70450
keywords: patch, patch
2008-07-30 09:38:47amaury.forgeotdarcsetkeywords: patch, patch
assignee: amaury.forgeotdarc
messages: + msg70420
nosy: + amaury.forgeotdarc
2008-07-30 04:19:40gvanrossumsetkeywords: patch, patch
messages: + msg70418
2008-07-28 17:05:42benjamin.petersonsetpriority: critical -> release blocker
keywords: patch, patch
2008-07-13 18:54:47gregory.p.smithlinkissue2534 dependencies
2008-07-09 21:10:15gvanrossumsetkeywords: patch, patch
nosy: + gvanrossum
messages: + msg69486
2008-06-11 18:09:41barrysetpriority: release blocker -> critical
nosy: + barry
messages: + msg68003
keywords: patch, patch
2008-05-13 08:39:00georg.brandlsetpriority: release blocker
keywords: patch, patch
2008-04-04 08:17:23thellersetkeywords: patch, patch
messages: + msg64921
2008-04-03 15:51:13ajaksu2setfiles: + test_exceptions.diff
nosy: + ajaksu2
messages: + msg64899
2008-04-03 08:58:59thellercreate