pdb.py Uses the Breakpoint class so one can enable/disable breakpoints,
set temporary ones, set ignore counts, and conditions. The last
can be set using the 'b' command
b 243 , i>4 ( b 243,i>4 if you are space adverse)
or with the condition command so conditions can be changed
for a particular breakpoint.
Breakpoints are numbered from 1 on, and if a breakpoint is deleted,
the number is not reused. All the breakpoint handling commands
refer to breakpoints by number. To be consistent, the clear command
does so as well, which is the one change from the original pdb that
is not transparent. Thus only the breakpoint command 'b' uses a
line number or file:line or method. You can also give
b whrandom.random and the method will be searched for along
sys.path. This is implemented with an 'egrep' command and so
is not as portable as it might be. [ see lineinfo() and
lineinfoCmd ]
Breakpoints cannot be set at a line that is blank or a '#' comment
or starts a triply quoted comment. This is because I would like
this behavior in my DDD interface and think it reasonable for
pdb as well. It can be removed readily, however as it is all
incorporated in the routine checkline(). If one attempts to
set a breakpoint at a 'def' line, the breakpoint is automatically
moved to the first executable line after the 'def'. This too is
in checkline().
do_EOF() returns zero so typing an end-of-file character as a command
does nothing. 'quit' does the quitting.
The routine defaultFile() is present so as to preserve the current
pdb behavior and yet allow me to override it in pydb.
There's some code in lineinfo() that is probably mainly useful only
for pydb and if you prefer, much up to the comment "Best first guess"
could be removed.
Keith Davidson provided the code for handling $HOME/.pdbrc and
./.pdbrc, and it has been incorporated. He also provided the
alias handling routine. I modified it a bit so it could live
nicely in precmd(). He and I have been in contact; he has the
new pdb (and pydb) with his code incorporated. He also asked
about the possibility of allowing multiple commands on one
line, such as step;step or s;s or with an alias such as
alias ct tbreak %1 ; continue
and since it was so easy, that's in place as well. It's a simple
'split the line at the first ";"' operation and puts the second
half in the command queue (self.cmdqueue). This has the unfortunate
effect of destroying a line like print "i: "+i+"; j: "+j
but either there's a simple way to deal with this, or my attitude
will remain that pdb is a debugger, not a compiler/parser/etc.
An alias like alias 4s s;;s;
will work because the adjacent and trailing ";" act like a <cr> which
repeats the last command. Of course, either s;s;s;s or s;;; would be
a bit more sensible.
bdb.py now has a class definition called Breakpoint along with
associated methods. There's no reason why this class has to
be there; if you prefer it elsewhere, 'tis easily done.
(Minor reformatting by GvR; e.g. moved Breakpoint's doc string to
proper point.)
cmd.py has incorporated the changes we discussed a couple of weeks ago
(a command queue, returning line from precmd, and stop from postcmd)
and some changes to help that were occasioned because I wanted to
inherit from pdb which inherits from cmd.py and the help routine
didn't look for commands or the associated help deeply enough.
Fix a bug where comparison of a rational with a float failed because
the difference got converted to float.
Put brackets around the string representation of (non-integer)
rationals.
(Sjoerd Mullender.)
Should no longer surround PyOS_Readline() call with
Py_{BEGIN,END}_ALLOW_THREADS macros. Also get rid of the declaration
for it (it's now in pythonrun.h).
Jeremy Hylton [Wed, 2 Sep 1998 21:53:16 +0000 (21:53 +0000)]
Easy optimizations of urlparse for the common case of parsing an http URL.
1. use dict.get instead of try/except KeyError
2. if the url scheme is 'http' then avoid the series of
'if var in [someseq]:'. instead, inline all of the code.
3. find = string.find
Guido van Rossum [Mon, 31 Aug 1998 14:14:09 +0000 (14:14 +0000)]
Now that we have standard (optional) long long support, the long long
support in this module can go. The patch only deletes code
(PyLong_FromLongLong() and PyLong_AsLongLong()). By Sjoerd Mullender.
Guido van Rossum [Thu, 27 Aug 1998 19:43:43 +0000 (19:43 +0000)]
We now assume that PyOS_Readline() is called with the interpreter lock
held. It releases the lock around the call to the function pointed to by
PyOS_ReadlineFunctionPointer (default PyOS_StdioReadline()).
Guido van Rossum [Thu, 27 Aug 1998 19:21:53 +0000 (19:21 +0000)]
Add a 'volatile' to the declaration of threadid in get_thread_ident().
According to Vladimir Marangozov, this is necessary for AIX, where
high optimization levels inline this function and then get it wrong :-(
Guido van Rossum [Thu, 27 Aug 1998 19:02:51 +0000 (19:02 +0000)]
Changes by Richard Wolff:
1) I added a command queue which is helpful to me (at least so far) and
would also allow syntax like 's;s' (step; step) in conjunction with precmd
2) doc_leader allows the derived class to print a message before the help
output. Defaults to current practise of a blank line
3) nohelp allows one to override the 'No help on' message. I need
'Undefined command: "%s". Try "help".'
4) Pass line to self.precmd to allow one to do some parsing: change first
word to lower case, strip out a leading number, whatever.
5) Pass the result of onecmd and the input line to postcmd. This allows
one to ponder the stop result before it is effective.
6) emptyline() requires a if self.lastcmd: conditional because if the
first command is null (<cr>), you get an infinite recursion with the
code as it stands.
Guido van Rossum [Tue, 25 Aug 1998 18:44:34 +0000 (18:44 +0000)]
__file__ used to be always set to the .pyc (or .pyo) file, even if
that file in fact did not exist or at least was not used. Change this
so that __file__ is *only* set to the .pyc/.pyo file when it actually
read the code object from it; otherwise __file__ is set to the .py
file.
Guido van Rossum [Tue, 25 Aug 1998 18:22:17 +0000 (18:22 +0000)]
Comment out the print statement about underflow. (This only seems to
happen when you use a non-keyword argument after a keyword argument,
and in this case you also get a syntax error. I fully suspect that
the underflow is caused by the code that stops generating code when it
detects the syntax error, but I can't find the culprit right now. I
know, I know.)
Guido van Rossum [Tue, 25 Aug 1998 16:07:15 +0000 (16:07 +0000)]
Patch by Mark Hammond to support 64-bit ints on MS platforms.
The MS compiler doesn't call it 'long long', it uses __int64,
so a new #define, LONG_LONG, has been added and all occurrences
of 'long long' are replaced with it.
2-digit years are now converted using rules that are (according to
Fredrik Lundh) recommended by POSIX or X/Open: 0-68 mean 2000-2068,
69-99 mean 1969-1999.
2-digit years are now only accepted if time.accept2dyear is set to a
nonzero integer; if it is zero or not an integer or absent, only year
values >= 1900 are accepted. Year values 100-1899 and negative year
values are never accepted.
The initial value of time.accept2dyear depends on the environment
variable PYTHONY2K: if PYTHONY2K is set and non-empty,
time.accept2dyear is initialized to 0; if PYTHONY2K is empty or not
set, time.accept2dyear is initialized to 0.
Guido van Rossum [Tue, 25 Aug 1998 14:06:55 +0000 (14:06 +0000)]
New version, with contributions from Sjoerd Mullender and Mark Hammond.
Sjoerd writes:
This version of freeze creates one file per Python module, instead of
one humongous file for all Python modules.
bkfile: new module to used to write files with backups. No new file
is produced if the new contents is identical to the old.
New option "-x excluded-module" for modulefinder test program.
New option "-i filename" for freeze main program to include a list of
options in place of the -i option.
Guido van Rossum [Tue, 25 Aug 1998 12:29:08 +0000 (12:29 +0000)]
There was still something wrong. The original NOTTESTS are replaced
by the new '-x' arguments, losing the previous items. Thus,
test_support, test_b1 & test_b2 are executed (and warnings issued).
(Discovered by Vladimir Marangozov.)
Guido van Rossum [Mon, 24 Aug 1998 14:15:44 +0000 (14:15 +0000)]
Ted Horst writes in psa-members@python.org:
This is a patch that Bill Bummgarner did for 1.4 that hasn't made its
way into the distribution yet. This is important if you want to use
the ObjC module.
The .subn() method wasn't setting _num_regs, which is used by the .groups()
method, so .groups() didn't work inside the replacement function
called by re.sub. One-line fix: set self._num_regs inside subn().
Barry Warsaw [Thu, 20 Aug 1998 21:51:27 +0000 (21:51 +0000)]
(py-shell-map): New variable contains the keymap used in *Python*
shell buffers.
(py-shell): Moved the require of comint to the top level. Also
use-local-map py-shell-map instead of hacking on the comint-mode-map.
This eliminates breakage of other comint-mode buffers (e.g. shell).
Barry Warsaw [Thu, 20 Aug 1998 19:44:51 +0000 (19:44 +0000)]
(py-process-filter): Deleted this function. In order to fix
interactions with newer Emacsen, I've rewritten the way all the
process filters work in the *Python* buffer. We use more of the
comint infrastructure, specifically the default process filter. This
means that scrolling is now handled by the default comint variables
including comint-scroll-to-bottom-on-output. Note that this is
somewhat experimental change!
(py-comint-output-filter-function): Moved to here from the obsolete
py-process-filter function, the logic to pop and exec the next queued
file waiting to be executed.
(py-execute-file): Don't bind comint-scroll-to-bottom-on-output to t,
and save the excursion when inserting the "working on" message. This
lets the standard comint scrolling variables as set by the user,
continue to work.
(python-mode, py-shell, py-describe-mode): Remove description of
py-scroll-process-buffer. Also in py-shell, make
comint-output-filter-functions buffer-local, and add
py-comint-output-filter-function to this hook (instead of setting the
process filter).
(py-scroll-process-buffer): Deleted this variable. See comint
variables including comint-scroll-to-bottom-on-output.
(py-execute-region): When exec files are being queued, push the next
temp file on the end of the list.
(py-submit-bug-report): Removed reporting of py-scroll-process-buffer.
Jack Jansen [Thu, 20 Aug 1998 15:48:52 +0000 (15:48 +0000)]
All libraries have now been moved to their new location, with their new names.
As everything is also under CVS this should greatly simplify the work to be done
when a new version of one of the libraries we use is released.
Added an example that uses signal.alarm() to time out an os.open() that
takes too long. This example relies on the fact that raising an
exception in a signal handler causes the exception to be re-raised
when the main line of the program resumes execution. Is this guaranteed
in CPython, or is this something that just happens to work by accident?
Fred Drake [Tue, 18 Aug 1998 17:43:08 +0000 (17:43 +0000)]
Raise the right exception (ValueError) for attempted I/O on closed StringIO
objects; this makes the emulation of file objects a bit better, and the
exceptions explain things a bit better.
Jack Jansen [Tue, 18 Aug 1998 14:35:56 +0000 (14:35 +0000)]
I give in (after all these years): renaming config.c to macconfig.c to forestall
the continuous name conflicts which cause the wrong config.c to be found.
Barry Warsaw [Tue, 18 Aug 1998 02:00:44 +0000 (02:00 +0000)]
(imenu-example--create-python-index-engine): Fix nesting breakage when
a method definition has args that span multiple lines; be sure to go
to the beginning of the method definition -- but watch out for the
match-data!
Jeremy Hylton [Thu, 13 Aug 1998 23:13:52 +0000 (23:13 +0000)]
Enter Jim Fulton's latest version. He writes:
I had to make a slight diddle to work with Python 1.4, which
we and some of our customers are still using. :(
I've also made a few minor enhancements:
- You can now both get and set the memo using a 'memo'
attribute. This is handy for certain advanced applications
that we have.
- Added a 'binary' attribute to get and set the binary
mode for a pickler.
- Added a somewhat experimental 'fast' attribute. When this
is set, objects are not placed in the memo during pickling.
This should lead to faster pickling and smaller pickles in
cases where:
o you *know* there are no circular references, and
o either you've:
- preloaded the memo with class information
by pickling classes in non-fast mode or by
manipilating the memo directly, or
Fred Drake [Thu, 13 Aug 1998 22:03:46 +0000 (22:03 +0000)]
Do the magic to use the new buttons (with shorter names!) instead of the old
ones. Get the <IMG> width & height right. New design for the navigation
bars, including the document title as well as the navigation links/buttons.
Jeremy Hylton [Thu, 13 Aug 1998 19:57:46 +0000 (19:57 +0000)]
Change interface to sendmail: if the destination address is a string
instead of a list, turn it into a list containing that string. This
avoids an apparently common newbie mistake -- passing in a single
string for the destination and have it treated as a sequence of
characters.