DaveS writes:
> According to the docs for 'break', when called with a function name it
> should set the breakpoint at the first executable line of the function.
> Right now "break sub1" will set the breakpoint at the definition of the
> function, not the execution of it (like when setting a breakpoint by line
> number).
Okay, will investigate when I get chance but I'm not sure when that
will be. Doing lots of Ruby/Rails nowadays.
> It looks like the function name is not being set when the breakpoint is
> parsed in get_brkpt_lineno (fns.py). I've attached a patch that does the
> right thing.
>
> --- fns.py 2007-03-13 19:25:03.087000000 -0700
> +++ fns.py.orig 2007-03-13 19:23:37.321375000 -0700
> @@ -356,7 +356,6 @@
> code = func.func_code
> # use co_name to identify the bkpt (function names
> #could be aliased, but co_name is invariant)
> - funcname = arg
> lineno = code.co_firstlineno
> filename = code.co_filename
> except:
Although I agree there seems to be a bug, I'm not convinced this is
the right thing. The comment seems to indicate that code.co_name
should be used. So what are the merits/demerits of using that co_name
versus arg?
Could you make up a little test case that shows the bug, and maybe why
arg is better than co_name or vice versa?
Thanks.
|