Message293185
This proposal would be useful. My use case is for when an API suppresses an external exception context:
>>> import os
>>> try:
... os.environ["NEW_VARIABLE"] = bug # Hidden exception
... finally:
... del os.environ["NEW_VARIABLE"] # KeyError
...
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "/usr/lib/python3.5/os.py", line 699, in __delitem__
raise KeyError(key) from None
KeyError: 'NEW_VARIABLE'
This feels like a step backwards to Python 2, and enabling the full backtrace would make this easier to analyze:
>>> try:
... os.environ["NEW_VARIABLE"] = bug # TypeError
... finally:
... del dict()["NEW_VARIABLE"] # KeyError
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/lib/python3.5/os.py", line 688, in __setitem__
value = self.encodevalue(value)
File "/usr/lib/python3.5/os.py", line 756, in encode
raise TypeError("str expected, not %s" % type(value).__name__)
TypeError: str expected, not object
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
KeyError: 'NEW_VARIABLE' |
|
Date |
User |
Action |
Args |
2017-05-07 09:29:05 | martin.panter | set | recipients:
+ martin.panter, rhettinger, serhiy.storchaka, wolma, Mariatta |
2017-05-07 09:29:04 | martin.panter | set | messageid: <1494149344.94.0.867219791133.issue30097@psf.upfronthosting.co.za> |
2017-05-07 09:29:04 | martin.panter | link | issue30097 messages |
2017-05-07 09:29:04 | martin.panter | create | |
|