473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

pdb in python2.5

Hi,

Maybe I'm repeating a previous post (please correct me if I am).

I've tried the following code in python 2.5 (r25:51908, Oct 6 2006,
15:22:41)
example:

from __future__ import with_statement
import threading

def f():
l = threading.Lock()
with l:
print "hello"
raise Exception("error")
print "world"

try:
f()
except:
import pdb
pdb.pm()

This fails because pdb.pm() attempts to access sys.last_traceback which
is not assigned.
Trying:
pdb.post_mortem(sys.exc_traceback)

Yields the following:
test.py(9)f()
-print "world"
(Pdb)

the 'w' command yields a similar output, which implies that the
exception was thrown from the wrong line.
the traceback module is better, yielding correct results (displays line
8 instead of 9).

Has anyone encountered this behavior? is pdb broken?
I get similar results for larger/more complex pieces of code.

Thanks in advance,

Rotem

Jan 25 '07 #1
5 1596
"Rotem" <vm*****@gmail.comwrites:
Hi,

Maybe I'm repeating a previous post (please correct me if I am).

I've tried the following code in python 2.5 (r25:51908, Oct 6 2006,
15:22:41)
example:

from __future__ import with_statement
import threading

def f():
l = threading.Lock()
with l:
print "hello"
raise Exception("error")
print "world"

try:
f()
except:
import pdb
pdb.pm()

This fails because pdb.pm() attempts to access sys.last_traceback which
is not assigned.
Recent releases of pydb (http://bashdb.sf.net/pydb) don't suffer this
problem. (But see below.)
Trying:
pdb.post_mortem(sys.exc_traceback)

Yields the following:
test.py(9)f()
-print "world"
(Pdb)

the 'w' command yields a similar output, which implies that the
exception was thrown from the wrong line.
the traceback module is better, yielding correct results (displays line
8 instead of 9).

Has anyone encountered this behavior?
Yes, this seems to be a bug in pdb. It is using the traceback's f_line
instance variable rather than the tb_lineno instance variable. I guess
these two values are usually the same. In fact, I haven't been able to
come up with a Python 2.4 situtation where they are different. (If
someone can, I'd appreciate it if you'd send me a small example so I
can put it in the pydb regression tests.) Even in 2.5, it's kind of
hard to get a case where they are different. If I remove the "with",
the problem goes away.

It was also bug in pydb, but I've just committed in CVS the fix for
this

is pdb broken?
Best as I can tell pdb isn't all that well maintained. (Had it been, I
probably wouldn't have devoted the time to pydb that I have been.)
I get similar results for larger/more complex pieces of code.
>
Thanks in advance,

Rotem
Jan 25 '07 #2
I'd like to change my assessment of whether the problem encountered is
a pdb bug or not. It could be a bug in Python. (Right now it is only
known to be a bug in version 2.5.)

For a given traceback t, the question is whether t.tb_frame.f_lineno
can ever be different from t.tb_lineno.

Still, for now in pydb CVS, I've worked around this by checking.

ro***@panix.com (R. Bernstein) writes:
"Rotem" <vm*****@gmail.comwrites:
Hi,

Maybe I'm repeating a previous post (please correct me if I am).

I've tried the following code in python 2.5 (r25:51908, Oct 6 2006,
15:22:41)
example:

from __future__ import with_statement
import threading

def f():
l = threading.Lock()
with l:
print "hello"
raise Exception("error")
print "world"

try:
f()
except:
import pdb
pdb.pm()

This fails because pdb.pm() attempts to access sys.last_traceback which
is not assigned.

Recent releases of pydb (http://bashdb.sf.net/pydb) don't suffer this
problem. (But see below.)
Trying:
pdb.post_mortem(sys.exc_traceback)

Yields the following:
test.py(9)f()
-print "world"
(Pdb)

the 'w' command yields a similar output, which implies that the
exception was thrown from the wrong line.
the traceback module is better, yielding correct results (displays line
8 instead of 9).

Has anyone encountered this behavior?

Yes, this seems to be a bug in pdb. It is using the traceback's f_line
instance variable rather than the tb_lineno instance variable. I guess
these two values are usually the same. In fact, I haven't been able to
come up with a Python 2.4 situtation where they are different. (If
someone can, I'd appreciate it if you'd send me a small example so I
can put it in the pydb regression tests.) Even in 2.5, it's kind of
hard to get a case where they are different. If I remove the "with",
the problem goes away.

It was also bug in pydb, but I've just committed in CVS the fix for
this

is pdb broken?

Best as I can tell pdb isn't all that well maintained. (Had it been, I
probably wouldn't have devoted the time to pydb that I have been.)
I get similar results for larger/more complex pieces of code.

Thanks in advance,

Rotem
Jan 25 '07 #3
Hi,

I noticed that pydb.pm() also fails in python2.5 when invoked on that
same example (seems like also trying to access a nonexistent
attribute/variable).

Is this known to you as well/was it fixed?

On Jan 25, 9:15 pm, r...@panix.com (R. Bernstein) wrote:
I'd like to change my assessment of whether the problem encountered is
a pdb bug or not. It could be a bug in Python. (Right now it is only
known to be a bug in version 2.5.)

For a given traceback t, the question is whether t.tb_frame.f_lineno
can ever be different from t.tb_lineno.

Still, for now in pydb CVS, I've worked around this by checking.

r...@panix.com (R. Bernstein) writes:
"Rotem" <vmal...@gmail.comwrites:
Hi,
Maybe I'm repeating a previous post (please correct me if I am).
I've tried the following code in python 2.5 (r25:51908, Oct 6 2006,
15:22:41)
example:
from __future__ import with_statement
import threading
def f():
l = threading.Lock()
with l:
print "hello"
raise Exception("error")
print "world"
try:
f()
except:
import pdb
pdb.pm()
This fails because pdb.pm() attempts to access sys.last_traceback which
is not assigned.
Recent releases of pydb (http://bashdb.sf.net/pydb) don't suffer this
problem. (But see below.)
Trying:
pdb.post_mortem(sys.exc_traceback)
Yields the following:
test.py(9)f()
-print "world"
(Pdb)
the 'w' command yields a similar output, which implies that the
exception was thrown from the wrong line.
the traceback module is better, yielding correct results (displays line
8 instead of 9).
Has anyone encountered this behavior?
Yes, this seems to be a bug in pdb. It is using the traceback's f_line
instance variable rather than the tb_lineno instance variable. I guess
these two values are usually the same. In fact, I haven't been able to
come up with a Python 2.4 situtation where they are different. (If
someone can, I'd appreciate it if you'd send me a small example so I
can put it in the pydb regression tests.) Even in 2.5, it's kind of
hard to get a case where they are different. If I remove the "with",
the problem goes away.
It was also bug in pydb, but I've just committed in CVS the fix for
this
is pdb broken?
Best as I can tell pdb isn't all that well maintained. (Had it been, I
probably wouldn't have devoted the time to pydb that I have been.)
I get similar results for larger/more complex pieces of code.
Thanks in advance,
Rotem
Jan 25 '07 #4
"Rotem" <vm*****@gmail.comwrites:
Hi,

I noticed that pydb.pm() also fails in python2.5 when invoked on that
same example (seems like also trying to access a nonexistent
attribute/variable).

Is this known to you as well/was it fixed?
Doesn't do that for me for Python 2.5 on both pydb 1.20 (last released
version) and the current CVS. See below. If you think the problem is
not on your end and want to file a bug report, please do. But note

* comp.lang.python is not the place to file bug reports
* more detail is needed that what's been given so far

$ cat /tmp/t1.py
from __future__ import with_statement
import threading

def f():
l = threading.Lock()
with l:
print "hello"
raise Exception("error")
print "world"

try:
f()
except:
import pydb
pydb.pm()
$ python /tmp/t1.py
hello
(/tmp/t1.py:9): f
(Pydb) where
-0 f() called from file '/tmp/t1.py' at line 9
## 1 <module>() called from file '/tmp/t1.py' at line 15
(Pydb) show version
pydb version 1.20.
(Pydb) quit
$ python /tmp/t1.py
hello
(/tmp/t1.py:15): <module>
(Pydb) where
## 0 f() called from file '/tmp/t1.py' at line 8
-1 <module>() called from file '/tmp/t1.py' at line 15
(Pydb) show version
pydb version 1.21cvs.
(Pydb) quit
$
Jan 26 '07 #5
* comp.lang.python is not the place to file bug reports
Agreed
* more detail is needed that what's been given so far
Agreed. I will investigate further when I get a chance and determine if
it's a problem on my end.

Thanks a lot!

Jan 26 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jakub Moscicki | last post by:
Hello, A small problem: I get a signal during a system call (from xmlrpclib -> httplib) and an exception "IOError: Interrupted system call" is raised (this is system dependant, on other machine...
4
by: tudor | last post by:
hello! I had python 2.2.1 so I upgraded to python 2.3.2, but all my applications using python (rh8) give errors now. I installed from src.rpm Traceback (most recent call last): File...
3
by: Adil Hasan | last post by:
Hello, I'm having problems trying to use ZSI to connect to a https url. I give the command and I get prompted for my X509 cert pass-phrase, but the program dies with an openssl error. Here's my...
1
by: km | last post by:
Hi all, is there a debian binary of python2.4 ? tia, KM
1
by: Tim N. van der Leeuw | last post by:
Hi, When trying to use win32com functionality with Python2.4, the interpreter often crashes! I don't know if it's a known problem already that will be fixed in an upcoming Python2.4.1...
0
by: Wolfgang | last post by:
I have a problem with linking my CPP Code under a irix6 machine (sgi, UNIX). In my CPP code I use some Functions which are written in Python. So its a kind of CPP wrapper for my Python functions In...
6
by: Miernik | last post by:
On my Debian GNU/Linux system I have Python 2.3 installed in /usr/lib/python2.3/ where most Python system files like /usr/lib/python2.3/gzip.py /usr/lib/python2.3/gzip.pyc...
2
by: venkatbo | last post by:
Hi all, I have python2.4 running on ppc-linux 2.6.17. I'm attempting to get a TurboGears 0.9a9 (using CherryPy 2.2.1) based app running on it. During the TG-app startup sequence, it reaches...
15
by: Christopher Taylor | last post by:
RHEL comes with Python2.3 installed. A program I need to install requires Python2.4 So I got Python2.4 from source and compiled it up. I configured it with --prefix=/usr --exec-prefix=/usr...
6
by: samn | last post by:
i compiled and installed the release version of python 2.5 for linux to a directory accessible to 2 computers, configured with --prefix=/usr/arch (which is accessible to both machines). the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.