Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 broken backtrace + typo #59

Closed
HJarausch opened this issue Mar 3, 2013 · 6 comments
Closed

python3 broken backtrace + typo #59

HJarausch opened this issue Mar 3, 2013 · 6 comments

Comments

@HJarausch
Copy link

Try the code snippet below, do one single step which raises an exception.
Enter 'e' to show the exception. This kills pudb .
The reason is that the second component of

exc_tuple
is a string object while traceback/format_exception excepts it to be of type
Exception
.

Furthermore there is a typo in shell.py (line 27)

-    except Exception, e:
+    except Exception as e:

Thanks for looking into it,
Helmut.

# !/usr/bin/python3

from pudb import set_trace
L=['a','b','c']
set_trace()
i= L.index('e')

"""
Traceback (most recent call last):
  File "PUDB_T.py", line 7, in 
    i= L.index('e')
  File "/usr/lib64/python3.3/bdb.py", line 53, in trace_dispatch
    return self.dispatch_exception(frame, arg)
  File "/usr/lib64/python3.3/bdb.py", line 94, in dispatch_exception
    self.user_exception(frame, arg)
  File "/usr/lib64/python3.3/site-packages/pudb/debugger.py", line 279, in user_exception
    self.interaction(frame, exc_tuple)
  File "/usr/lib64/python3.3/site-packages/pudb/debugger.py", line 226, in interaction
    show_exc_dialog=show_exc_dialog)
  File "/usr/lib64/python3.3/site-packages/pudb/debugger.py", line 1256, in call_with_ui
    return f(_args, *_kwargs)
  File "/usr/lib64/python3.3/site-packages/pudb/debugger.py", line 1386, in interaction
    self.event_loop()
  File "/usr/lib64/python3.3/site-packages/pudb/debugger.py", line 1343, in event_loop
    toplevel.keypress(self.size, k)
  File "/usr/lib64/python3.3/site-packages/pudb/ui_tools.py", line 87, in keypress
    return handler(self, size, key)
  File "/usr/lib64/python3.3/site-packages/pudb/debugger.py", line 996, in show_traceback
    "".join(format_exception(*self.current_exc_tuple)))]),
  File "/usr/lib64/python3.3/traceback.py", line 181, in format_exception
    for value, tb in values:
  File "/usr/lib64/python3.3/traceback.py", line 122, in _iter_chain
    context = exc.__context__
AttributeError: 'str' object has no attribute '**context**'
"""
@asmeurer
Copy link
Collaborator

asmeurer commented Mar 4, 2013

That's actually not a typo. That's how you have to do it for Python 2.4 and 2.5 support. But it doesn't work in Python 3. I don't know if there's a way around it.

@asmeurer
Copy link
Collaborator

asmeurer commented Mar 4, 2013

@inducer
Copy link
Owner

inducer commented Mar 5, 2013

The real issue is that I thought the installation script for pudb contained an invocation of 2to3, which should've made this issue disappear, but it did not. Fixed in 4f913f6. Please reopen if there's still an issue.

@inducer inducer closed this as completed Mar 5, 2013
@asmeurer
Copy link
Collaborator

asmeurer commented Mar 5, 2013

That's because you decided to use a single code base. If you switch to 2to3, there is a lot of code that can be simplified. I think you can probably delete the py3compat file completely.

@asmeurer
Copy link
Collaborator

asmeurer commented Mar 5, 2013

See #1.

@inducer
Copy link
Owner

inducer commented Mar 6, 2013

Wow. Goes to show how little I remember of the cr*p I said years ago. :) Re-fixed by 4059aeb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants