1 message in org.python.python-bugs-list[ python-Bugs-875404 ] global stmt ca...
FromSent OnAttachments
SourceForge.netMar 10, 2004 5:22 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[ python-Bugs-875404 ] global stmt causes breakpoints to be ignoredActions...
From:SourceForge.net (nore@sourceforge.net)
Date:Mar 10, 2004 5:22:26 pm
List:org.python.python-bugs-list

Bugs item #875404, was opened at 2004-01-12 06:52 Message generated for change (Comment added) made by isandler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=875404&group_id=5470

Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Maciej Kalisiak (mackal) Assigned to: Nobody/Anonymous (nobody) Summary: global stmt causes breakpoints to be ignored

Initial Comment: It seems that having a "global" statement in "main()" (perhaps elsewhere too) causes pdb to ignore breakpoints in the whole application. See the attached example small program.

Procedure: - pdb python_bug.py # the attached program - 's', and then 'n' once or twice to make sure prog loaded - 'break main' - 'c'

If the "global foo" statement is present, pdb will not stop at the breakpoint. If it is commented out (and "foo = 1" as well, of course), the breakpoint is obeyed.

I'm using Python 2.3 (from the Debian "sid" distribution) Tried under Linux 2.2.20, as well as 2.4.*.

Maciej Kalisiak mac at dgp dot toronto dot edu

----------------------------------------------------------------------

Comment By: Ilya Sandler (isandler) Date: 2004-03-10 14:22

Message: Logged In: YES user_id=971153

The same behaviour exists in the CVS version of python

Here is what (I think) happens:

1. When you try to set a break on a function: e.g "b main" pdb sets a breakpoint not at "def main", but at the next non comment/non-blank line of code

2. Sample code has "global " as a first non-comment/non-blank line of code, so that's where pdb sets the breakpoint

3. But global is a compile-time statement, the line with global is never reached at run time, so pdb never stops there

Workaround for the original submitter: put any other executable stmt as the first line of your main(), or set a bkpt via line number

However, this behaviour is still wrong...The bug could be probably fixed by adding more logic to pdb.checkline()....

Are there any other compile-time only statements?

I think I could submit a patch for this problem, but does anyone look at pdb related patches?? My previous pdb patch #896011 has been sitting in the queue for a month now...

----------------------------------------------------------------------