Message45390
| Author |
isandler |
| Recipients |
| Date |
2004年10月08日.05:25:25 |
| SpamBayes Score |
| Marked as misclassified |
| Message-id |
| In-reply-to |
| Content |
Logged In: YES
user_id=971153
> (this is the frame.f_lineno <= 0 part of the patch, right?).
Yes
>However, your fix (which should be in lookupmodule), is a bit
> too broad. 'b pbd_t:2' works, but
>'b <random_other_file_in_script_directory>:2' also works, while
>it shouldn't.
I am not sure I agree here: e.g even in CVS version of pdb
you can set a breakpoint in a random file (as long as this
file is specified via absolute path or can be found in
sys.path)...
E.g.
'b pydoc.py:124' succeeds even if your script never loads pydoc
And I think this is in general a useful behaviour as
debugger has no way (in general) to know that a particular
source file may be loaded in the future..
As far as placement of it in lookupmodule(). Well, I guess I
was afraid to change existing function (as it could
theoretically break some other code). Another issue is that,
strictly speaking, lookupmodule() already does more then
just looks up modules, so I did not want to add even more to
it...I don't feel strongly either way, so if you think
lookupmodule() is the place to fix B3, let me know...
>do_debug_script() would fit better as a method on the Pdb
>class. It seems to have a bit of feature envy towards the
>pdb class. What do you think?
Well, yes and no: e.g basic setup for the script debugging
g={"__name__" : "__main__"}
l=g
pdb._initial_file=pdb.canonic(filename)
statement='execfile( "'+ filename+'")'
pdb.run(statement, globals=g, locals=l)
could indeed become a method of Pdb, but I am not sure
about the wrapping loop/postmortem, which would result in a
method which never return...
> I'd like to rename the method to runscript() for
>consistency with the rest of pdb.
I could add runscript() with the above code in it and still
have the main() function which is responsible for the loop
and postmortem.. Would it be better?
>E2. Nice addition. It could do with better docs.
> Come to think of it, all of this needs to be documented. A
new
>doc section on running the module as a script would be nice.
Could you elaborate a bit on what would like to see in such
a doc? (E.g normaly such docs would include command line
options, but we don't have any and the cli itself is already
documented)
. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2007年08月23日 15:32:22 | admin | link | issue896011 messages |
| 2007年08月23日 15:32:22 | admin | create |
|