homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Mariatta, martin.panter, rhettinger, serhiy.storchaka, wolma
Date 2017年05月07日.09:29:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494149344.94.0.867219791133.issue30097@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2017年05月07日 09:29:05martin.pantersetrecipients: + martin.panter, rhettinger, serhiy.storchaka, wolma, Mariatta
2017年05月07日 09:29:04martin.pantersetmessageid: <1494149344.94.0.867219791133.issue30097@psf.upfronthosting.co.za>
2017年05月07日 09:29:04martin.panterlinkissue30097 messages
2017年05月07日 09:29:04martin.pantercreate

AltStyle によって変換されたページ (->オリジナル) /