STINNER Victor added the comment: "This patch introduces a bit ugly traceback. Shouldn't there be “raise from None” or “raise from previous_exc” instead of simple raise?"
Oh, I see. >>> os.environb[b'10'] Traceback (most recent call last): File "/home/vstinner/prog/python/default/Lib/os.py", line 648, in __getitem__ value = self._data[self.encodekey(key)] KeyError: b'10' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/vstinner/prog/python/default/Lib/os.py", line 651, in __getitem__ raise KeyError(key) KeyError: b'10' Attached patch adds "from None". ---------- resolution: fixed -> status: closed -> open Added file: http://bugs.python.org/file31441/os_environb_raise_from_none.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17702> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com