Message239205
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 pyerr_match_clear-2.patch.
int, before:
| $ python3 -c 'int("123z")'
| Traceback (most recent call last):
| File "<string>", line 1, in <module>
| ValueError: invalid literal for int() with base 10: '123z'
int, after:
| $ ./python -c 'int("123z")'
| ValueError: invalid literal for int() with base 10: '123z'
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
| File "<string>", line 1, in <module>
| ValueError: invalid literal for int() with base 10: '123z'
struct, before:
| $ python3 -c 'import struct; struct.pack("b", 2**100)'
| Traceback (most recent call last):
| File "<string>", line 1, in <module>
| struct.error: argument out of range
struct, after:
| $ ./python -c 'import struct; struct.pack("b", 2**100)'
| OverflowError: Python int too large to convert to C long
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
| File "<string>", line 1, in <module>
| struct.error: argument out of range
More examples, after (still without pyerr_match_clear-2.patch):
int(str):
| TypeError: a bytes-like object is required, not 'type'
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
| File "<stdin>", line 1, in <module>
| TypeError: int() argument must be a string, a bytes-like object or a number, not 'type'
''.join(str):
| TypeError: 'type' object is not iterable
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
| File "<stdin>", line 1, in <module>
| TypeError: can only join an iterable
b"%f" % "abc":
| TypeError: a float is required
|
| During handling of the above exception, another exception occurred:
|
| Traceback (most recent call last):
| File "<stdin>", line 1, in <module>
| TypeError: float argument required, not str |
|
Date |
User |
Action |
Args |
2015-03-25 00:52:58 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka |
2015-03-25 00:52:58 | vstinner | set | messageid: <1427244778.02.0.928118006884.issue23763@psf.upfronthosting.co.za> |
2015-03-25 00:52:57 | vstinner | link | issue23763 messages |
2015-03-25 00:52:57 | vstinner | create | |
|