Helmut Jarausch added the comment:
The problem is caused by the new format_exception in Python's traceback.py
file. It reads
def format_exception(etype, value, tb, limit=None, chain=True):
list = []
if chain:
values = _iter_chain(value, tb)
else:
values = [(value, tb)]
for value, tb in values:
if isinstance(value, str):
and then
def _iter_chain(exc, custom_tb=None, seen=None):
if seen is None:
seen = set()
seen.add(exc)
its = []
context = exc.__context__
As you can see, the new keyword parameter chain is True by default. Thus,
iter_chain is called by default.
And there you have context= exc.__context__.
Now, if value is an object of type str Python tries to access the __context__
field of an object of type str.
And this raises an attribute error.
In an application (pudb) I've used the fixed
exc_info= sys.exc_info()
....
format_exception(*exc_info,chain=not isinstance(exc_info[1],str))
So, why is the keyword parameter 'chain' True by default.
This causes the problem.
----------
nosy: +HJarausch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17413>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com