Commit Graph

2156 Commits

Author SHA1 Message Date
Guido van Rossum 9b112799bc On Windows, we suddenly find, strftime() may return "" for an
unsupported format string.  (I guess this is because the logic for
deciding whether to reallocate the buffer or not has been improved.)
This caused the test code to crash on result[0].  Fix this by assuming
an empty result also means the format is not supported.
1999-04-08 17:23:11 +00:00
Guido van Rossum 6e9dadc1da Delete an accidentally checked-in feature that actually broke more
than was worth it: when deleting a canvas item, it would try to
automatically delete the bindings for that item.  Since there's
nothing that says you can't reuse the tag and still have the bindings,
this is not correct.  Also, it broke at least one demo
(Demo/tkinter/matt/rubber-band-box-demo-1.py).
1999-04-08 14:46:06 +00:00
Guido van Rossum 052364b20b Use binary mode for all gzip files we open. 1999-04-07 19:00:58 +00:00
Guido van Rossum 0d8d3dd5b0 lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift,
so the preferred name for them is tag_lower, tag_raise
(similar to tag_bind, and similar to the Text widget);
unfortunately can't delete the old ones yet (maybe in 1.6)
1999-04-07 16:25:54 +00:00
Guido van Rossum 296e14301a Changes by Per Cederquist and The Dragon.
Per writes:

"""
The application where Signum Support uses smtplib needs to be able to
report good error messages to the user when sending email fails.  To
help in diagnosing problems it is useful to be able to report the
entire message sent by the server, not only the SMTP error code of the
offending command.

A lot of the functions in sendmail.py unfortunately discards the
message, leaving only the code.  The enclosed patch fixes that
problem.

The enclosed patch also introduces a base class for exceptions that
include an SMTP error code and error message, and make the code and
message available on separate attributes, so that surrounding code can
deal with them in whatever way it sees fit.  I've also added some
documentation to the exception classes.

The constructor will now raise an exception if it cannot connect to
the SMTP server.

The data() method will raise an SMTPDataError if it doesn't receive
the expected 354 code in the middle of the exchange.

According to section 5.2.10 of RFC 1123 a smtp client must accept "any
text, including no text at all" after the error code.  If the response
of a HELO command contains no text self.helo_resp will be set to the
empty string ("").  The patch fixes the test in the sendmail() method
so that helo_resp is tested against None; if it has the empty string
as value the sendmail() method would invoke the helo() method again.

The code no longer accepts a -1 reply from the ehlo() method in
sendmail().

[Text about removing SMTPRecipientsRefused deleted --GvR]
"""

and also:

"""
smtplib.py appends an extra blank line to the outgoing mail if the
`msg' argument to the sendmail method already contains a trailing
newline.  This patch should fix the problem.
"""

The Dragon writes:

"""
	Mostly I just re-added the SMTPRecipientsRefused exception
(the exeption object now has the appropriate info in it ) [Per had
removed this in his patch --GvR] and tweaked the behavior of the
sendmail method whence it throws the newly added SMTPHeloException (it
was closing the connection, which it shouldn't.  whatever catches the
exception should do that. )

	I pondered the change of the return values to tuples all around,
and after some thinking I decided that regularizing the return values was
too much of the Right Thing (tm) to not do.

	My one concern is that code expecting an integer & getting a tuple
may fail silently.

(i.e. if it's doing :

      x.somemethod() >= 400:
expecting an integer, the expression will always be true if it gets a
tuple instead. )

	However, most smtplib code I've seen only really uses the
sendmail() method, so this wouldn't bother it.  Usually code I've seen
that calls the other methods usually only calls helo() and ehlo() for
doing ESMTP, a feature which was not in the smtplib included with 1.5.1,
and thus I would think not much code uses it yet.
"""
1999-04-07 15:03:39 +00:00
Guido van Rossum 630a9a6894 Fix the tests now that splitdrive() no longer treats UNC paths special.
(Some tests converted to splitunc() tests.)
1999-04-06 19:38:18 +00:00
Guido van Rossum f3c695c467 Withdraw the UNC support from splitdrive(). Instead, a new function
splitunc() parses UNC paths.  The contributor of the UNC parsing in
splitdrive() doesn't like it, but I haven't heard a good reason to
keep it, and it causes some problems.  (I think there's a
philosophical problem -- to me, the split*() functions are purely
syntactical, and the fact that \\foo is not a valid path doesn't mean
that it shouldn't be considered an absolute path.)

Also (quite separately, but strangely related to the philosophical
issue above) fix abspath() so that if win32api exists, it doesn't fail
when the path doesn't actually exist -- if GetFullPathName() fails,
fall back on the old strategy (join with getcwd() if neccessary, and
then use normpath()).
1999-04-06 19:32:19 +00:00
Fred Drake fa1591c129 Oops, missed mode parameter to open(). 1999-04-05 18:37:59 +00:00
Fred Drake 9bb76d1b73 Made the default mode 'rb' instead of 'r', for better cross-platform
support.  (Based on comment on the documentation by Bernhard Reiter
<bernhard@csd.uwm.edu>).
1999-04-05 18:33:40 +00:00
Greg Ward 06ca948029 Added all the "external action" methods (to make handling the verbose
and dry-run flags consistently painless): 'execute()', 'mkpath()',
'copy_file()', 'copy_tree()', 'make_file()', and stub for 'make_files()'
(not sure yet if it's useful).
1999-04-04 02:58:07 +00:00
Greg Ward e765a3bb61 Added 'dry_run' flag to most functions (to support the "shadow methods"
that wrap them in the Command class).
Fixed 'copy_file()' to use '_copy_file_contents()', not 'copyfile()'
  from shutil module -- no reference to shutil anymore.
Added "not copying" announcement in 'copy_file()'.
Wee comment fix.
1999-04-04 02:54:20 +00:00
Greg Ward 4070f50537 Changed to use the method versions of 'copy_file()', 'copy_tree()',
and 'make_file()'-- that way, the verbose and dry-run flags are
handled for free.
1999-04-04 02:46:29 +00:00
Guido van Rossum 8ff764f113 Jonathan Giddy write:
In test_cpickle.py, the module os got imported, but the line to remove
the temp file has gone missing.
1999-04-01 15:32:30 +00:00
Guido van Rossum 60e7330fee Per Cederqvist writes:
If you send something like "PUT / HTTP/1.0" to something derived from
BaseHTTPServer that doesn't define do_PUT, you will get a response
that begins like this:

	HTTP/1.0 501 Unsupported method ('do_PUT')
	Server: SimpleHTTP/0.3 Python/1.5
	Date: Tue, 30 Mar 1999 18:53:53 GMT

The server should complain about 'PUT' instead of 'do_PUT'.  This
patch should fix the problem.
1999-03-30 20:17:31 +00:00
Guido van Rossum f123f84f66 Patch by Per Cederqvist, who writes:
"""
 - It needlessly used the makefile() method for each response that is
   read from the SMTP server.

 - If the remote SMTP server closes the connection unexpectedly the
   code raised an IndexError.  It now raises an SMTPServerDisconnected
   exception instead.

 - The code now checks that all lines in a multiline response actually
   contains an error code.
"""

The Dragon approves.
1999-03-29 20:33:21 +00:00
Fred Drake 9065ea36de When run as a script, report failures in the exit code as well.
Patch largely based on changes by Andrew Dalke, as discussed in the
distutils-sig.
1999-03-29 20:25:40 +00:00
Guido van Rossum 3527f59457 Hack so that if a 302 or 301 redirect contains a relative URL, the
right thing "just happens" (basejoin() with old URL).
1999-03-29 20:23:41 +00:00
Guido van Rossum 89ae2b9f07 Test protection against picling to/from closed (real) file. 1999-03-29 19:59:32 +00:00
Greg Ward 91c488c1fc Replaced the last attempt at an "unreadline" with one that actually
works on non-seekable file-like objects, such as URLs.  (Oops.)
1999-03-29 18:01:49 +00:00
Guido van Rossum 8e702d4e8e Jonathan Giddy discovered this file was missing. 1999-03-29 15:28:54 +00:00
Greg Ward 787451b65f Added 'linestart' array and 'unreadline()' method (makes parsing a lot easier). 1999-03-26 21:48:59 +00:00
Guido van Rossum 447b4a0652 Test suite for UserList. 1999-03-26 16:20:45 +00:00
Guido van Rossum 2a340b3889 Use isinstance() where appropriate.
Reformatted with 4-space indent.
1999-03-26 16:20:18 +00:00
Guido van Rossum 3eccc48b5b Test suite for UserDict 1999-03-26 15:32:05 +00:00
Guido van Rossum 1697b9cdf6 Improved a bunch of things.
The constructor now takes an optional dictionary.
Use isinstance() where appropriate.
1999-03-26 15:31:12 +00:00
Guido van Rossum aa3828aa35 Basic regr tests for pickle/cPickle 1999-03-25 22:38:49 +00:00
Guido van Rossum 397032aa46 Don't use "exec" in find_class(). It's slow, unnecessary, and (as AMK
points out) it doesn't work in JPython Applets.
1999-03-25 21:58:59 +00:00
Andrew M. Kuchling 605ebddbea Added a simple test suite for gzip. It simply opens a temp file,
writes a chunk of compressed data, closes it, writes another chunk, and
reads the contents back to verify that they are the same.
1999-03-25 21:50:27 +00:00
Andrew M. Kuchling f4f119c055 Based on a suggestion from bruce@hams.com, make a trivial change to
allow using the 'a' flag as a mode for opening a GzipFile.  gzip
files, surprisingly enough, can be concatenated and then decompressed;
the effect is to concatenate the two chunks of data.

If we support it on writing, it should also be supported on reading.
This *wasn't* trivial, and required rearranging the code in the
reading path, particularly the _read() method.

Raise IOError instead of RuntimeError in two cases, 'Not a gzipped file'
and 'Unknown compression method'
1999-03-25 21:49:14 +00:00
Guido van Rossum 52a0d7d802 Add tests for float() and complex() with string args (Nick/Stephanie
Lockwood).
1999-03-25 21:25:01 +00:00
Guido van Rossum a6386ce1eb Added Jeremy's test code for the sha module. 1999-03-24 19:04:32 +00:00
Guido van Rossum 4ec2698725 Remove the temp file when we're done. 1999-03-24 19:03:01 +00:00
Guido van Rossum e256a0feed Add readlines() to _Subfile class. Not clear who would need it, but
Chris Lawrence sent me a broken version; this one is a tad simpler and
more conforming to the standard.
1999-03-24 16:20:45 +00:00
Jeremy Hylton c19f9972a1 use struct instead of bit-manipulate in Python 1999-03-23 23:05:34 +00:00
Greg Ward 782cdfe9f3 Changes to allow passing an open file to the constructor (to support
ProcessHierarchy's changes to support reading from a remote URL in
ProcessDatabase).
1999-03-23 14:00:06 +00:00
Andrew M. Kuchling dca7e00fd5 Added simple test for the flush() method of compression objects, trying the
different flush values Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH.
1999-03-22 19:23:17 +00:00
Guido van Rossum f247d75507 Bug reported by Tobias Thelen: missing "self." in assignment target. 1999-03-22 15:28:08 +00:00
Greg Ward 13ae1c8ff8 First checkin of real Distutils command modules. 1999-03-22 14:55:25 +00:00
Greg Ward 03f8c3cdd0 Obsolete source file -- command options are actually implemented in
a much less formalistic way.  Just keeping this around for possible
future reference.
1999-03-22 14:54:09 +00:00
Greg Ward 2689e3ddce First checkin of real Distutils code. 1999-03-22 14:52:19 +00:00
Guido van Rossum 8f0fa9e47f New code for split() by Tim Peters, behaves more like posixpath.split(). 1999-03-19 21:05:12 +00:00
Guido van Rossum 36561c5de4 Added BufferType, the type returned by the new builtin buffer(). Greg Stein. 1999-03-19 19:08:03 +00:00
Guido van Rossum f3963b1269 Sjoerd Mullender writes:
If a filename on Windows starts with \\, it is converted to a URL
which starts with ////.  If this URL is passed to urlparse.urlparse
you get a path that starts with // (and an empty netloc).  If you pass
the result back to urlparse.urlunparse, you get a URL that starts with
//, which is parsed differently by urlparse.urlparse.  The fix is to
add the (empty) netloc with accompanying slashes if the path in
urlunparse starts with //.  Do this for all schemes that use a netloc.
1999-03-18 15:10:44 +00:00
Guido van Rossum a0fec1637b Sjoerd Mullender writes:
Pathnames of files on other hosts in the same domain
(\\host\path\to\file) are not translated correctly to URLs and back.
The URL should be something like file:////host/path/to/file.
Note that a combination of drive letter and remote host is not
possible.
1999-03-18 14:21:41 +00:00
Guido van Rossum a2e18051b7 Delete non-standard-conforming code in urljoin() that would use the
netloc from the base url as the default netloc for the resulting url
even if the schemes differ.

Once upon a time, when the web was wild, this was a valuable hack
because some people had a URL referencing an ftp server colocated with
an http server without having the host in the ftp URL (so they could
replicate it or change the hostname easily).

More recently, after the file: scheme got added back to the list of
schemes that accept a netloc, it turns out that this caused weirdness
when joining an http: URL with a file: URL -- the resulting file: URL
would always inherit the host from the http: URL because the file:
scheme supports a netloc but in practice never has one.

There are two reasons to get rid of the old, once-valuable hack,
instead of removing the file: scheme from the uses_netloc list.  One,
the RFC says that file: uses the netloc syntax, and does not endorse
the old hack.  Two, neither netscape 4.5 nor IE 4.0 support the old
hack.
1999-03-17 22:30:10 +00:00
Guido van Rossum eb354b31e5 Bug reported by Jim Robinson:
An attempt to execute grid_slaves with arguments (0,0) results in
*all* of the slaves being returned, not just the slave associated with
row 0, column 0.  This is because the test for arguments in the method
does not test to see if row (and column) does not equal None, but
rather just whether is evaluates to non-false.  A value of 0 fails
this test.
1999-03-16 21:54:50 +00:00
Guido van Rossum 3764595c98 Yet another patch by Sjoerd Mullender:
Don't convert URLs to URLs using pathname2url.
1999-03-15 16:16:29 +00:00
Guido van Rossum d5138caba5 Patch by Michael Scharf. He writes:
The module cmd requires for each do_xxx command a help_xxx
    function. I think this is a little old fashioned.

    Here is a patch: use the docstring as help if no help_xxx
    function can be found.

[I'm tempted to rip out all the help_* functions from pdb, but I'll
resist it.  Any takers?  --Guido]
1999-03-12 22:15:43 +00:00
Guido van Rossum 4edf656402 Remove stuff with unsure copyright status 1999-03-12 19:31:51 +00:00
Guido van Rossum 367ac80d3b From: Sjoerd Mullender
The filename to URL conversion didn't properly quote special
characters.
The URL to filename didn't properly unquote special chatacters.
1999-03-12 14:31:10 +00:00
Fred Drake cbd987040e Added .rdf and .xsl as application/xml types. (.rdf is for the
Resource Description Framework, a metadata encoding, and .xsl is for
the Extensible Stylesheet Language.)
1999-03-11 16:04:04 +00:00
Guido van Rossum 59e4f37d76 Test for popen2 module, by Chris Tismer. 1999-03-11 13:26:23 +00:00
Guido van Rossum 29aab7582f open_http also had the 'data is None' test backwards. don't call with the
extra argument if data is None.
1999-03-09 19:31:21 +00:00
Greg Ward db75afe6e5 Added collapse_ws option. 1999-03-08 21:46:11 +00:00
Jeremy Hylton b30f52a471 http_error had the 'data is None' test backwards. don't call with the
extra argument if data is None.
1999-02-25 16:14:58 +00:00
Jeremy Hylton f90b002e31 change indentation from 8 spaces to 4 spaces 1999-02-25 16:12:12 +00:00
Jeremy Hylton 547c3f1c13 pleasing the tabnanny 1999-02-25 15:59:54 +00:00
Fred Drake bff3ae1f75 Oops, one more "x, y, z" to convert... 1999-02-25 14:26:02 +00:00
Fred Drake 87209172f0 Adjusted comment at the top to be less confusing, following Fredrik
Lundh's example.

Converted comment to docstring.
1999-02-25 14:24:22 +00:00
Fred Drake e1c717bd9b Moved whatsound to lib-old/, since it was declared obsolete and is documented
as such.
1999-02-24 18:59:24 +00:00
Fred Drake 0652a4e7d5 Use sndhdr instead of the obsolete whatsound module. 1999-02-24 18:49:15 +00:00
Jeremy Hylton dbc8364e1f When performing a POST request, i.e. when the second argument to
urlopen is used to specify form data, make sure the second argument is
threaded through all of the http_error_NNN calls.  This allows error
handlers like the redirect and authorization handlers to properly
re-start the connection.
1999-02-24 18:42:38 +00:00
Guido van Rossum 4fe6caaaf0 Patch by Lars Wirzenius:
o the initial comment is wrong: creating messages is already
	  implemented

	o Message.getbodytext: if the mail or it's part contains an
	  empty content-transfer-encoding header, the code used to
	  break; the change below treats an empty encoding value the same
	  as the other types that do not need decoding

	o SubMessage.getbodytext was missing the decode argument; the
	  change below adds it; I also made it unconditionally return
	  the raw text if decoding was not desired, because my own
	  routines needed that (and it was easier than rewriting my
	  own routines ;-)
1999-02-24 16:25:17 +00:00
Barry Warsaw 40db48c5ec Document the correct class hierarchy for SystemExit. It is not an
error and so it derives from Exception and not SystemError.  The
docstring was incorrect but the implementation was fine.
1999-02-24 00:27:39 +00:00
Guido van Rossum 83c03e2d94 Add import sys, needed by reference to sys.exc_info() in rmtree().
Discovered by Mitch Chapman.
1999-02-23 23:07:51 +00:00
Guido van Rossum 74ee886409 1. Print the error message (carefully) when a dl.open() fails in verbose mode.
2. When no test case worked, raise ImportError instead of failing.
1999-02-23 17:58:48 +00:00
Guido van Rossum 027188a382 According to Jeffrey Honig, bsd/os 2.0 - 4.0 should be added to the
list (of bsd variants that have a different lock structure).
1999-02-23 04:14:32 +00:00
Guido van Rossum 5ef8f0c3c7 According to Jeffrey Honig, bsd/os 4.0 should be added to the list. 1999-02-23 04:13:37 +00:00
Guido van Rossum 4505895e68 As Des Barry points out, we need to call pathname2url(file) in two
calls to addinfourl() in open_file().
1999-02-22 19:01:42 +00:00
Guido van Rossum fb801e7d33 As Finn Bock points out, _P_WAIT etc. don't have a leading underscore
so they don't need to be treated specially here.
1999-02-22 15:40:34 +00:00
Guido van Rossum 974e32d910 Steve Clift pointed out that 'file' allows a netloc. 1999-02-22 15:38:46 +00:00
Guido van Rossum 11a8d0b684 Dang. Even though this is obsolete code, somebody found a bug, and I
fix it.  Oh well.
1999-02-22 15:19:47 +00:00
Fred Drake 3d199af40d Bow to font-lock at the end of the docstring, since it throws stuff
off.

Make sure the path paramter to readmodule() is a list before adding it
with sys.path, or the addition could fail.
1999-02-18 20:51:50 +00:00
Fred Drake d804f4eea0 _safe_repr(): Simplify the condition tests in the first possible
return path.
1999-02-17 17:30:52 +00:00
Guido van Rossum 5d856fcd0f The usual 1999-02-16 20:05:35 +00:00
Guido van Rossum ed52a20c6e In open_ftp(), check that retrlen is not None before using it in a %d format! 1999-02-16 15:10:12 +00:00
Guido van Rossum 72ce85823c Fix by Chris Petrilli (to his own code) to limit the number of
iterations looking for expansions to 10.
1999-02-12 14:13:10 +00:00
Guido van Rossum c731723730 Mod by Jack Jansen: on Macintosh, use EasyDialogs.GetPassword if it
exists.
1999-02-11 14:41:46 +00:00
Guido van Rossum 00f7da4f1e Patch by Steve Clift -- fix the indices now that f_fsid is no longer returned! 1999-02-10 13:12:07 +00:00
Guido van Rossum 2e7840fe8f The usual. 1999-02-09 18:40:13 +00:00
Guido van Rossum 9e1721fa79 Tim Peters:
+ Implements a put_nowait method.
+ Adds a corresponding Queue.Full exception.
+ Simplifies the implementation by adding optional "block" args to get() and
put(), and makes the old get_nowait() and new put_nowait() one-line
redirections to get() and put().
+ Uses (much) simpler logic for the nowait cases.
+ Regularizes the doc strings to something closer to "Guido style" <wink>.
+ Converts two stray tabs into spaces.
+ Removes confusing verbiage about the queue "not being available" from the
docstrings -- never knew what that meant as a user, and after digging into
the implementation still didn't know what it was trying to say.
1999-02-08 18:34:01 +00:00
Guido van Rossum c55b0ca601 Put a try-except around the "image delete" call in Image.__del__ to
avoid tracebacks when the root is destroyed before the image object.
1999-02-08 15:26:49 +00:00
Guido van Rossum d42e46ead5 Ehm, when we don't need to byteswap the data, don't go through an
array object at all.
1999-02-05 22:32:11 +00:00
Guido van Rossum ebb9c922cb Two important fixes:
(1) on a little-endian platform, don't byteswap;

(2) in _patchheader(), there was a missing self._file argument to a
_write_long() call.
1999-02-05 22:28:17 +00:00
Guido van Rossum 14162abf6e The encoding type was wrong, I think. 1999-02-05 20:57:44 +00:00
Guido van Rossum 2013ba48a6 Should open files in binary mode!
Also finally get rid of some obsolete commented-out access statements.

A note about the previous checkin: I believe it's correct, but I found
something strange: the file Lib/test/audiotest.au in the Python
distribution was evidently encoded in u-LAW format but had its
encoding set to 2, i.e. linear-8.  I hope that this is a mistake
caused by some conversion program that produced this .au file; I just
found it on a website.
1999-02-05 20:55:16 +00:00
Guido van Rossum 5ebeea0467 Shouldn't be treating linear-8 as u-law! 1999-02-05 19:59:27 +00:00
Guido van Rossum ead9d8d2d7 New test for ntpath module 1999-02-03 17:21:21 +00:00
Guido van Rossum 534972bce2 New splitdrive() that knows about UNC paths (e.g., network paths like
\\host\mountpoint\dir\file).  By Larry Hastings.

Also cleaned up some docstrings.
1999-02-03 17:20:50 +00:00
Guido van Rossum 2e3f7bece0 Fredrik Lundh fixes Sjoerd's patch...
"""Sjoerd's version stores unbound methods.  that's not good enough ;-)
Here's an alternative implementation of fixdict."""
1999-02-02 22:15:24 +00:00
Guido van Rossum cc2c291b7f Patch by Sjoerd Mullender to placate /F:
Fix leaking of instances by removing the elements variable that we
created on closing the parser.  The elements variable is now created
in the reset() method, so that the sequence close(); reset();
... works.
Also, add the name of the entity reference that wasn't found to the
error message.
1999-02-02 17:54:38 +00:00
Guido van Rossum 67c65b2954 Special-case _P_WAIT etc. for NT. 1999-02-01 23:52:29 +00:00
Guido van Rossum fe64935cf9 Patch by Sjoerd Mullender for better compatibility with the version
from Python 1.5.1:

If after __init__ finishes no new elements variable was created, this
patch will search the instance's namespace for all attributes whose
name start with start_ or end_ and put their value in a new elements
instance variable.
1999-02-01 15:35:13 +00:00
Guido van Rossum c0780ac8f3 From: Mike Orr <mso@oz.net>
In the docstring of ConfigParser.py  (Python 1.5.2b1):
    read(*filenames) -- read and parse the list of named configuration files

should be:
    read(filenames) -- read and parse the list of named configuration files

The method accepts a list, not a bunch of positional arguments.
Which is good, the list is much more convenient.
1999-01-30 04:35:47 +00:00
Guido van Rossum ca44236a1c Embarrassing: remove a debug print statement from set_break() for the
second time!
1999-01-29 22:39:32 +00:00
Guido van Rossum 9787bea4cd Use win32api.GetFullPathName(path) if it exists to implement abspath(). 1999-01-29 22:30:41 +00:00
Guido van Rossum 170e190f26 Support a canonical() method, implementable by a derived class, to be
applied to all filenames before they are compared, looked up in the
breaks dictionary, etc.  The default implementation does nothing --
it's implented as fast as possible via str().  A useful implementation
would make everything a absolute, e.g. return os.path.normcase(
os.path.abspath(filename)).
1999-01-29 22:03:51 +00:00
Guido van Rossum e294cf620a Add abspath() 1999-01-29 18:05:18 +00:00
Barry Warsaw e11e3dee3e Added a -s option which is useful for narrowing down memory leaks.
With -s only a single test is run.  The next test run is chosen
sequentially from the list of all tests.
1999-01-28 19:51:51 +00:00
Barry Warsaw ab11f60bb3 Added a new test for old filter() memory leak 1999-01-28 19:44:06 +00:00
Guido van Rossum b657c9344f Improvement of b/w compat note in help text for clear, by Richard Wolff. 1999-01-28 14:38:32 +00:00
Barry Warsaw 72588741dd Slight reworking of this test. If nis.maps() gives a nis.error, then
raise an ImportError if not running verbose.  This signals to the
regression framework that this test isn't applicable.
1999-01-28 04:54:33 +00:00
Guido van Rossum 583cc31c22 Get rid of do_clear_break / do_clb command -- it is redundant.
(It was left in accidentally after a long and arduous 3-way patch session.)
1999-01-27 22:43:55 +00:00
Barry Warsaw f09f6a5565 Re-format the module docstring and document the new get() argument. 1999-01-26 22:01:37 +00:00
Guido van Rossum e6506e753b Patch by Chris Petrilli (not really tested since I don't know this
module myself) to accept an option keyword argument (vars) that is
substituted on top of the defaults that were setup in __init__.  The
patch also fixes the problem where you can't have recusive references
inside your configuration file.
1999-01-26 19:29:25 +00:00
Guido van Rossum 3e0d319196 The usual. 1999-01-25 21:57:29 +00:00
Fred Drake dfd8954e36 Allow recognition of attributes even if they don't have space in front
of them.  I.e., '<a name="foo"href="bar.html">' will now have two
attributes recognized.

Based on comments from newgroup.
1999-01-25 21:57:07 +00:00
Guido van Rossum 2fff84d892 Don't die if CodeType doesn't exist -- ignore the error. This could
happen in restricted mode.
1999-01-25 21:37:02 +00:00
Guido van Rossum 0189c010c3 Correct typo in new function get_breaks(). 1999-01-25 20:56:33 +00:00
Guido van Rossum 816a9fbd2c Change clear syntax to support three alternatives:
clear
    clear file:line
    clear bpno bpno ...

Also print the breakpoint data after calling set_break(), because the
print statement in set_break() has gone.
1999-01-25 20:56:07 +00:00
Guido van Rossum 6ea27cc2c6 Change clear_break() to the old signature clear_break(file, line).
Add new clear_bpbynumber() with single bpno argument.  (Adapted from
a patch by Richard Wolff.)

Also some cleanup in error messages and moved some comments into a
docstring.
1999-01-25 20:51:34 +00:00
Fred Drake 0237909e42 Enable os.path as a mostly-normal submodule, including "from os.path
import isfile" and "import os.path".
1999-01-19 16:05:13 +00:00
Greg Ward f6cdcd509d Added 'warn' method. 1999-01-18 17:08:16 +00:00
Guido van Rossum 433892021e Added doc strings to the exception classes.
Contributed by Blake Winton, but considerably edited.
1999-01-15 04:03:46 +00:00
Guido van Rossum 40233ea70a Patch by Piers Lauder: make exceptions classes.
Take opportunity to add more explanatory messages to exceptions.
1999-01-15 03:23:55 +00:00
Barry Warsaw e75888eb85 Test the rfc822.py module. Contains just a few simple cases, and some
troublesome ones encountered on the c.l.py list.
1999-01-14 20:00:58 +00:00
Barry Warsaw 8a578436f4 Message.getaddrlist(): This now handles multiple occurances of the
named header, so that if a message has, e.g. multiple CC: lines, all
will get returned by the call to getaddrlist().  It also correctly
handles addresses which show up in continuation lines.

AdderlistClass.__init__(): Added \n to self.CR which fixes a bug that
sometimes, an address would contain a bogus trailing newline.

Message.getaddress(): In final else clause, added a test for the
character we're at being in self.specials.  Without this, such
characters never get consumed and we infloop.  Case in point (as
posted to c.l.py):

To: <[smtp:dd47@mail.xxx.edu]_at_hmhq@hdq-mdm1-imgout.companay.com>
----------------------------^
otherwise we'd infloop here
1999-01-14 19:59:58 +00:00
Guido van Rossum 348fd06890 In rcpt(), avoid a space after the TO: address when the option list is
empty.  Make sure there is a space when there are options.
1999-01-14 04:18:46 +00:00
Guido van Rossum e1bf7e8c1d Change the order of the utime() and the chmod() call in copystat().
This doesn't make a bit of difference on Unix, but apparently on
Windows NT you need write permission before you can set the utime...
1999-01-14 00:42:00 +00:00
Greg Ward d1dc47558c Added: mems.lib.text_file: provides TextFile class for parsing text
files with (optional) comment stripping, blank line skipping, whitespace
removal, and line joining with trailing backslashes.
1999-01-13 16:12:04 +00:00
Guido van Rossum 0039d7b4e6 A gift from Sam Rushing - modules asyncore and asynchat for the
standard Python library.  (Async socket support.)
1999-01-12 20:19:27 +00:00
Fred Drake f4bb656a4f DumbWriter.send_paragraph(): Fix problem with DumbWriter reported to
the newsgroup by Raymond Tong Leng Ng <rntl@yahoo.com>.
1999-01-12 18:13:27 +00:00
Fred Drake 6a1b53c165 get_config_h_filename(): Fix to work with current Python
installations; it was picking up a stale config.h from an
	overwritten installation.
1999-01-11 15:34:55 +00:00
Guido van Rossum 0bdbe6c5f0 Added some more comments. 1999-01-10 06:09:13 +00:00
Barry Warsaw 302331a3b6 FieldStorage.__init__(): if there is no content-type header, use
text/plain for inner parts, but application/x-www-form-urlencoded
for outer parts.  Honor any existing content-type header.

Lower down, if the content-type header is something we don't
understand (say because it there was a typo in the header coming from
the client), default to text/plain for inner parts, but
application/x-www-form-urlencoded for outer parts.
1999-01-08 17:42:03 +00:00
Andrew M. Kuchling 5c355201e2 Fixed bug in the common-case code for HTTP URLs; it would lose the query,
fragment, and/or parameter information.
3 cases added to the test suite to check for this bug.
1999-01-06 22:13:09 +00:00
Guido van Rossum 2386d7333f Constants for [f]statvfs() (new in posixmodule.c) by Steve Clift. 1999-01-06 18:54:57 +00:00
Fred Drake 522af3a126 Update and add docstrings. 1999-01-06 16:28:34 +00:00
Fred Drake dc1aedfe2e Move brief descriptions of what() and whathdr() to docstrings in the
functions (from comments).
1999-01-06 15:20:49 +00:00
Greg Ward 9ddaaa1a30 Another patch from Fred: factored _init_posix into
get_config_h_filename, get_makefile_filename, parse_config_h, and
parse_makefile.
1999-01-06 14:46:06 +00:00
Guido van Rossum f4bf044999 Got rid of whatraw().
Doc-string-ified the lead comments.
Added auto call of test() when run as script.
1999-01-06 13:05:58 +00:00
Guido van Rossum 638d7f14f8 Add extend() method. A small New Year's present from Jean-Claude Wippler. 1999-01-06 12:49:24 +00:00
Guido van Rossum 4494101858 Incorporate fix suggested by /Fredrik Lundh in the newsgroup to cope
with trailing garbage generated by some broke uuencoders.
1999-01-05 18:02:24 +00:00
Guido van Rossum f8d579c5e3 This hopefully fixes the problem of having to set PATH
in autoexec.bat in order to find the Tcl DLLs -- Tkinter calls FixTk
which will hunt around in a few common places and then set PATH
and try again, or else issue a big clarifying error message.
1999-01-04 18:06:45 +00:00
Guido van Rossum 82eae9eaa7 Added mt_interact() -- multithreaded version of interact().
interact() automatically uses this on Windows (where the
single-threaded version doesn't work).
1998-12-23 23:04:17 +00:00
Guido van Rossum db01ee0e22 Patch by Mike Meyer:
Extended the rfc822 parsedate routines to handle the cases they failed
on in an archive of ~37,000 messages.  I believe the changes are
compatible, in that all previously correct parsing are still correct.

[I still see problems with some messages, but no showstoppers.]
1998-12-23 22:22:10 +00:00
Guido van Rossum 9a4d63730e Patch by Mike Meyer:
Add a class to mailbox.py for dealing with qmail directory mailboxes.
The test code was extended to notice these being used as well.
1998-12-23 22:05:42 +00:00
Guido van Rossum 99e1131536 Avoid crash in parsedate_tz() on certain invalid dates -- when the
field assumed to be the time is in fact the year, the resulting list
doesn't have enough items, and this isn't checked for.  Return None
instead.
1998-12-23 21:58:38 +00:00
Barry Warsaw 0720177e3d Small, and final docstring merge with Dragon's version. 1998-12-22 20:37:36 +00:00
Guido van Rossum c822a453bd Add warning to Netrc's docstring that it is obsolete -- use the netrc
module instead.  (The main advantage of the latter is that it comes
with documentation.)
1998-12-22 16:49:16 +00:00
Guido van Rossum af5add4629 New test function by Sjoerd, adding -t option. 1998-12-22 14:23:50 +00:00
Guido van Rossum 7ea1d972d1 The usual.
# Message to all python-checkins readers: we have a problem with the
# CVS mirroring software.  You can't check out the latest changes yet.
# We hope to have fixed this by noon EST today.
1998-12-22 13:50:33 +00:00
Greg Ward 3c8e54bf62 Applied Fred's patch to fix the bugs that John Skaller noticed. 1998-12-22 12:42:04 +00:00
Guido van Rossum 9c30c24bc2 Adding shlex and netrc by Eric Raymond. 1998-12-22 05:19:29 +00:00
Barry Warsaw a7d9bdfab6 A few other docstring fixes, most importantly to be a little nicer to
Emacs ;-)
1998-12-22 03:24:27 +00:00
Barry Warsaw 4c4bec86f4 Nothing earthshattering, just some fixes to typos and other formatting
bugs in various docstrings.
1998-12-22 03:02:20 +00:00
Guido van Rossum d147a6c35a Renaming Lib/plat-beos1 to Lib/plat-beos at Chris Herborth's request 1998-12-21 19:18:55 +00:00
Guido van Rossum 98c17b3aee Marc-Andre Lemburg notes about statparse():
"""
The message ID is returned lowercased and there is no way to access
the original ID the server sent. Now at least some news servers
are very picky about the case of the ID and return errors when
fetching articles with mixed case given a lowercased version
of the ID.

The solution is simple: remove the string.lower() call.
"""

(I might add that the lowercasing was probably introduced as a result
of sloppy copy-and-paste coding; there's a string.lower in a similar
piece of code a bit higher in the source, that makes more sense --
it's lowercasing the group name.)
1998-12-21 18:51:23 +00:00
Guido van Rossum dfaac4df9e Add XXX comment about the need to add a dump() method to the Text
widget -- no time to do this right now.
1998-12-21 18:25:03 +00:00
Guido van Rossum c08cc50e00 Add XXX comment about a test that doesn't seem right -- no time to
explore this now.
1998-12-21 18:24:09 +00:00
Guido van Rossum 0b56a3e9a7 A mod whose author I forget. (I must've mislaid the email. If it's
yours, please let me know for propoer acknowledgement.)

This avoids recompiling files that haven't changed; it adds a -f
option to force recompilation.
1998-12-21 18:23:38 +00:00
Guido van Rossum 91c8f5901b Sjoerd Mullender:
- Fixed a bug where a syntax error was reported when a document
  started with white space.  (White space at the start of a document
  is valid if there is no XML declaration.)
- Improved the speed quite a bit for documents that don't make use of
  namespaces.
1998-12-21 18:15:28 +00:00
Guido van Rossum c6769c54f4 Typo discovered by Just. 1998-12-21 16:26:31 +00:00
Guido van Rossum 1f05708f69 Use __stdin__ instead of stdin to derive FileType -- safer against
assignments.
1998-12-19 23:53:33 +00:00
Greg Ward 1190ee3d03 Fred's sysconfig module. 1998-12-18 23:46:33 +00:00
Greg Ward ee789b9601 Initial checkin of distutils source files. 1998-12-18 22:00:30 +00:00
Guido van Rossum b083a9fb54 Sjoerd Mullender writes:
Here is my current version of xmllib.py and the documentation.  This
version has some API changes with respect to the version currently in
Python (also the one in 1.5.2a).
This version supports XML namespaces.
1998-12-18 20:17:13 +00:00
Guido van Rossum 33add0a95a Sjoerd Mullender:
File names with "funny" characters get translated wrong by
pathname2url (any variety).  E.g. the (Unix) file "/ufs/sjoerd/#tmp"
gets translated into "/ufs/sjoerd/#tmp" which, when interpreted as a
URL is file "/ufs/sjoerd/" with fragment ID "tmp".

Here's an easy fix.  (An alternative fix would be to change the
various implementations of pathname2url and url2pathname to include
calls to quote and unquote.

[The main problem is with the normal use of URLs:
	url = url2pathname(file)
	transmit url
	url, tag = splittag(url)
	urlopen(url)
]

In addition, this patch fixes some uses of unquote:
- the host part of URLs should be unquoted
- the file path in the FTP URL should be unquoted before it is split
  into components.
- because of the latter, I removed all unquoting from ftpwrapper,
  and moved it to the caller, but that is not essential
1998-12-18 15:25:22 +00:00
Andrew M. Kuchling dc86a4e5bb Added a -q ('quiet') option to tabnanny, which causes only the names of
offending files to be printed.  Good for emacs `tabnanny.py *.py`
1998-12-18 13:56:58 +00:00
Barry Warsaw 107e623ef0 grid_bbox(): support new Tk API: grid bbox ?column row? ?column2 row2? 1998-12-15 00:44:15 +00:00
Guido van Rossum 030d2ec16c In read_multi, allow a subclass to override the class we instantiate
when we create a recursive instance, by setting the class variable
'FieldStorageClass' to the desired class.  By default, this is set to
None, in which case we use self.__class__ (as before).
1998-12-09 22:16:46 +00:00
Guido van Rossum f8b3b944aa In __getslice__, use self.__class__ instead of UserList. 1998-12-09 22:15:01 +00:00
Guido van Rossum 204b65c50f Sjoerd patches the previous patch:
In literal mode, also don't do anything about entity and character
references, or about closing CDATA elements.
1998-12-08 13:25:00 +00:00
Guido van Rossum f484a3366b Sjoerd writes:
When literal mode is entered it should exit automatically when the
matching close tag of the last unclosed open tag is encountered.  This
patch fixes this.
1998-12-07 21:59:56 +00:00
Guido van Rossum 5c3b384a85 Patch by Jeff Rush:
In SimpleHTTPServer.py, the server specified in test() should
be BaseHTTPServer.HTTPServer, in case the request handler should
want to reference the two attributes added by
BaseHTTPServer.server_bind:

        self.server_name = hostname
        self.server_port = port

There was some Bobo CGI code that wanted access to those attributes.
1998-12-07 04:08:30 +00:00
Guido van Rossum 9228cbd084 Patch by Jeff Rush:
In CGIHTTPServer.py, the list of acceptable formats is -split-
on spaces but -joined- on commas, resulting in double commas
in the joined text.  It appears harmless to my browser but
ought to be fixed anyway.

    'A, B, C' -> 'A,', 'B,', 'C,' -> 'A,,B,,C'
1998-12-07 04:08:03 +00:00
Guido van Rossum 391c8b4ea2 Open the file in binary mode -- so serving images from a Windows box
might actually work.
1998-12-07 03:53:18 +00:00
Guido van Rossum b241b67b89 Turtle graphics 1998-12-04 16:42:46 +00:00
Barry Warsaw 8fe2a34e1f Added NotImplementedError, subclassed from RuntimeError 1998-12-01 18:36:30 +00:00
Guido van Rossum 67a40e814c Patch by Jeff Bauer: a minor change to declare two new
threaded versions of Unix Server classes, using the
ThreadingMixIn class:

    ThreadingUnixStreamServer
    ThreadingUnixDatagramServer
1998-11-30 15:07:01 +00:00
Guido van Rossum e720176548 Wrong pathname in docstring detected by Fredrik Nehr. 1998-11-25 15:57:47 +00:00
Guido van Rossum 691d27a7ae Bomb on deleting a temporary breakpoint: there's no method
do_delete(); do_clear() was meant.  By Greg Ward.
1998-11-18 15:56:06 +00:00
Guido van Rossum 6d06094c77 Accept a non-list sequence for the long options (request by Jack Jansen).
Because it might be a common mistake to pass a single string, this
situation is treated separately.

Since we were making a copy of the longopts list anyway, we now use
the list() function -- this made it necessary to change all uses of
the local variable (and argument) 'list' to something more meaningful,
i.e., 'opts'.

Also added docstrings (copied from the library manual) and removed the
(now redundant) module comments.
1998-11-17 04:16:37 +00:00
Guido van Rossum fdb3d1a75e Fix typo in docstring: client_request should be client_address.
Noted by Stefan Witzel.
1998-11-16 19:06:30 +00:00
Guido van Rossum e0fbe1c26d Declaring zmod and poly obsolete. They have problems. 1998-11-02 15:38:51 +00:00
Guido van Rossum 2457fc2a81 Improvement to the previous fix suggested by Thomas Bellman: if the
unlink() or fdopen() fail, close the file descriptor and re-raise the
exception.
1998-10-24 15:02:59 +00:00
Guido van Rossum dce3d5502e The TemporaryFile() function has a security leak -- because the
filenames generated are easily predictable, it is possible to trick an
unsuspecting program into overwriting another file by creating a
symbolic link with the predicted name.  Fix this by using the
low-level os.open() function with the O_EXCL flag and mode 0700.  On
non-Unix platforms, presumably there are no symbolic links so the
problem doesn't exist.  The explicit test for Unix (posix, actually)
makes it possible to change the non-Unix logic to work without a
try-except clause.

The mktemp() file is as unsafe as ever.
1998-10-24 01:34:45 +00:00
Guido van Rossum 5d42b5b74d Moved compile_command() to a file of its own (codeop.py). 1998-10-22 21:56:44 +00:00
Guido van Rossum c41c1a984e Moved compile_command() here from code.py, so JPython can provide its
own version.
1998-10-22 21:56:15 +00:00
Guido van Rossum d370379186 Jim Fulton writes:
"""
I've attached a long overdue patch to pickle.py to bring it to format
1.3, which is the same as 1.2 except that the binary float format
is supported.  This is done using the new platform-indepent format
features of struct.

This patch also gets rid of the undocumented obsolete Pickler
dump_special method.
"""
1998-10-22 20:15:36 +00:00
Guido van Rossum fbba304aaa Move 'import sys' to top of module, as noted by Tim Peters. 1998-10-22 16:18:25 +00:00
Guido van Rossum 04da10c7a2 Piers Lauder writes:
"""
Jochen Hayek has reported a problem with some versions of IMAP4
servers that choose to mix the case in their CAPABILITIES response.

The patch below fixes the problem.
"""
1998-10-21 22:06:56 +00:00
Guido van Rossum a9832bc572 Use (f1, f2) as cache key instead of f1 + ' ' + f2.
Noted by Fredrik Lundh.
(Note -- this module is pretty silly.)
1998-10-21 15:23:52 +00:00
Guido van Rossum f5745008d2 Patch by Jim Fulton, who writes:
"""
The FieldStorage constructor calls the read_multi method.  The read_multi
method creates new FieldStorage objects, re-invoking the constructor
(on the new objects).  The problem is that the 'environ', 'keep_blank_values',
and 'strict_parsing' arguments originally passed to the constructor are not
propigated to the new object constructors.  This causes os.environ to be used,
leading to a miss-handling of the parts.

I fixed this by passing these arguments to read_multi and then on to the
constructor.  See the context diff below.
"""
1998-10-20 14:43:02 +00:00
Guido van Rossum d90ae19b92 Rename 'locals' argument to top-level interact() function to 'local'
for b/w compatibility with 1.5.1.
1998-10-19 18:42:53 +00:00
Guido van Rossum eeb2f32aad Fixed a problem where xmllib didn't handle the tag
<sometag attrib=">">
correctly.
Also changed comparisons of re matches and searches into explicit
comparisons with None.
(Sjoerd Mullender)
1998-10-19 13:28:26 +00:00
Guido van Rossum d54fb7ae9b The usual 1998-10-17 18:09:27 +00:00
Guido van Rossum c2047c19f5 When run as a script, don't pass a fake __main__ dictionary; use the
real one.
1998-10-15 01:38:23 +00:00
Guido van Rossum b0e5718643 Fix so that after a fork() -- on Unix only -- the template gets
recalculated.
1998-10-14 20:27:05 +00:00
Guido van Rossum 9f1292d840 Perhaps a controversial change: when reporting a callback exception,
assign the exception info to sys.last_{type,value,traceback}.  That
way, an introspective Tkinter app can inspect its own stack trace.

(The controversy is that it would keep some objects alive, but that's
probably no big deal.)
1998-10-13 20:02:39 +00:00
Barry Warsaw 4eaadf002e Added {xview,yview}_{moveto,scroll} to the Canvas class. 1998-10-13 19:01:10 +00:00
Guido van Rossum e73d702344 Ever-so-slight improvementL the patterns to recognize import
statements now also stop at ';' (formerly they only stopped at '#').
1998-10-13 16:12:36 +00:00
Guido van Rossum 243ac4f497 Updated listbox methods to Tk 8.0. (Moved some around, added
x/yview_scroll/moveto.)
1998-10-13 13:37:30 +00:00
Guido van Rossum 3179b36014 When no master widget is specified, use options['parent'] if it exists. 1998-10-12 20:40:47 +00:00
Guido van Rossum 7f20263349 Only reference Tkinter._default_root when needed. 1998-10-12 20:40:09 +00:00
Guido van Rossum 0688436305 Enhancements by Sjoerd Mullender: support for
from a.b import c
	import a . b
1998-10-12 15:23:04 +00:00
Guido van Rossum 7a840e8d50 Add support for dotted module names to readmodule(). 1998-10-12 15:21:38 +00:00
Guido van Rossum 1c5fb1cd1b Make mimetypes.guess_type understand data URLs. (Sjoerd Mullender) 1998-10-12 15:12:28 +00:00
Guido van Rossum 56440a58f7 Fix two bugs in the fstat() line, reported by Fredruk Lundh. 1998-10-07 14:06:03 +00:00
Guido van Rossum d832f9e425 Fix append() calls with more than 1 argument. 1998-10-07 13:18:17 +00:00
Guido van Rossum da65450530 The message "Exception in Tkinter callback" should go to stderr.
Fix bug in NoDefaultRoot() -- _default_root wasn't declared global;
and made it reentrant.

Don't set _default_root to whatever master gets passed in to
BaseWidget._setup() (only set it when we need to create a new Tk()
widget).
1998-10-06 19:06:27 +00:00
Guido van Rossum 96372a2657 ST_MODE should be ST_MTIME in utime call in copystat. Thanks to Mike Orr. 1998-10-02 03:16:08 +00:00
Guido van Rossum 64e736ba4e Some new blood and some updated versions. 1998-10-02 01:23:47 +00:00
Guido van Rossum 4581a0c07b New test_long.py from Tim Peters. 1998-10-02 01:19:48 +00:00
Barry Warsaw 4cbe3876ec NSEW is also valid for -sticky 1998-10-01 15:54:48 +00:00
Barry Warsaw 9190046289 Added NS and EW constants, which are meaningful values for grid's
-sticky option.
1998-10-01 13:49:37 +00:00
Guido van Rossum f984a65267 Fix suggested by Sjoerd (long ago!) to get a better error message when
there's a syntax error.  (In particular, display the correct
filename).  This changes the API: if there's a syntax error, the
function now returns normally after dumping the error to sys.stderr.
I changed Sjoerd's use of string.join(string.split(...)) with
string.replace().
1998-09-29 15:57:42 +00:00
Guido van Rossum 26367a001d New version from Piers Lauder, who writes:
Added a debug function to replace 'print' statements.
Ensured that response attached to 'NO' replies is passed back.
added readonly exception.
Rearranged method order into types.
Ensure select returns a meaningful error on 'NO'.
'NO' returns from authenticate and login raise error with last message,
not list.
1998-09-28 15:34:46 +00:00
Guido van Rossum 75bb54c3d8 Don't set a local variable named __args__; this feature no longer
works and Greg Ward just reported a problem it caused...
1998-09-28 15:33:38 +00:00
Guido van Rossum 9ab96d40eb Changes by Eric Raymond:
1. Generate a correct Content-Length header visible through the info() method
   if a request to open an FTP URL gets a length in the response to RETR.

2. Take a third argument to urlretrieve() that makes it possible to progress-
   meter an urlretrieve call (this is what I needed the above change for).
   See the second patch band below for details.

3. To avoid spurious errors, I commented out the gopher test.  The target
   document no longer exists.
1998-09-28 14:07:00 +00:00
Barry Warsaw 9195f55bbf Updated the docstring and class hierarchy diagram 1998-09-25 22:43:21 +00:00
Guido van Rossum f7d77009c1 Add two constants (with the same value) to specify the on-board CD input. 1998-09-24 18:09:47 +00:00
Guido van Rossum 5227f0fdcd Reworked it quite a bit. There are now two classes: a base class,
InteractiveInterpreter, which handles parsing and interpreter state
but doesn't know deal with buffering or prompting or input file
naming.  And a derived class, InteractiveConsole, which adds buffering
and prompting and supports setting the filename once.  Also tweak the
algorithm in compile_command() a bit so that input consisting of all
blank lines or comments always succeeds immediately, and note the fact
that apart from SyntaxError it can also raise OverflowError.
1998-09-22 20:38:53 +00:00
Guido van Rossum 0238a25b20 Do the check for lacking sys.stdin.fileno() *before* testing for
Windows.  If sys.stdin doesn't appear to be a real file (characterized
by having a working fileno()), don't use any console specific methods
-- go straight to the default.
1998-09-22 02:38:42 +00:00
Guido van Rossum ef0056ae1a When sys.stdin.fileno() doesn't work, fall back to default_getpass()
-- don't just die.
1998-09-21 20:00:35 +00:00
Guido van Rossum 4ecd85aad7 After the previous changes, func_normalize() turned out to be redundant.
This simplified some other places in the code.
1998-09-21 17:40:47 +00:00
Guido van Rossum b0a94c0549 Changes so that JPython can also use this version of profile.py.
Suggested by Jim Hugunin.
1998-09-21 16:52:44 +00:00
Guido van Rossum f07029e4ba Get rid of the classes RModuleLoader and RModuleImporter -- these were
only there to override reload() in a way that doesn't make a whole lot
of sense and moreover broke since the latest changes in ihooks.
1998-09-21 14:53:26 +00:00
Guido van Rossum e3f8a64906 Comment out 't = t[0] + t[1]' in profiler_simulation() -- this
function is only used when running the calibration code, and it turns
out that recent changes in the timing code caused this statement to
raise an exception.
1998-09-21 14:52:22 +00:00
Guido van Rossum fc076d4ce2 Untabified and applied Richard Wolff's changes (plus my own reflowing
of some paragraphs).
1998-09-17 15:01:38 +00:00
Guido van Rossum 3a98e78a6e Richard Wolff's additional changes; some layout nits, and change the
alias delimiter to ';;'.
1998-09-17 15:00:30 +00:00
Guido van Rossum 743d17e3aa In load_inst(), when instantiating an instance the old way (i.e. when
there's an __getinitargs__() method), if a TypeError occurs, catch and
reraise it but add info to the error about the class name being
instantiated.  This makes debugging a lot easier if __getinitargs__()
returns something bogus (e.g. a string instead of a singleton tuple).
1998-09-15 20:25:57 +00:00
Guido van Rossum 0c92000b7a Ignore the TclError exception raised when deleting the registration
for callit, used by the after() command.  This can happen when the
callback deletes the window.
1998-09-14 19:06:39 +00:00
Guido van Rossum 8d5bef7fb8 There was a confusion in my checkin of the code to support list() with
and without a message number argument: the argument was called 'msg'
but the code expected it to be called 'which'.  In line with the other
methods, I've renamed the argument to 'which', and adapted the doc
string not to refer to 'msg'.
1998-09-14 17:36:51 +00:00
Guido van Rossum f9a6d7d494 Print serious errors to stderr instead of stdout. 1998-09-14 16:22:21 +00:00
Guido van Rossum 7944ea523e Patch by Marc-Andre Lemburg: use re module to compare test results.
This makes it possible to accept that on Linux %w returns "01" instead
of "1", for example.
1998-09-14 15:50:40 +00:00
Guido van Rossum f0a275d4db Richard Wolff's changes:
pdb.doc		Updated to reflect better the various changes.
1998-09-12 14:42:23 +00:00
Guido van Rossum 2424f855f3 Richard Wolff's changes:
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.

	The help commands have been updated.
1998-09-11 22:50:09 +00:00
Guido van Rossum d93643fe4a Richard Wolff's changes:
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.)
1998-09-11 22:38:35 +00:00
Guido van Rossum 5fca6fd2d9 Richard Wolff's changes:
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.
1998-09-11 22:33:08 +00:00
Guido van Rossum a063303693 Patch suggested by Perry Stoll -- os.path.normpath(".//x") returned
"/x", should return "x".
1998-09-08 22:28:06 +00:00
Jeremy Hylton b85c8479eb 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
1998-09-02 21:53:16 +00:00
Guido van Rossum f6ae743cb5 Fix suggested by movits@lockstar.com (plus doc string by myself)
for LIST command with msg argument.
1998-09-02 14:42:02 +00:00
Guido van Rossum c86b7c63e0 Make bind variants without a sequence return a tuple of sequences
(formerly it returned a string, which wasn't very convenient).

Add image commands to the Text widget (these are new in Tk 8.0).
1998-08-31 16:54:33 +00:00
Guido van Rossum b9f48608f6 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.
1998-08-27 19:02:51 +00:00
Jeremy Hylton 4722da6ebf fix typo in keyword argument 'allow_frament' should be 'allow_fragment' 1998-08-25 19:45:24 +00:00
Guido van Rossum 6c74fea07d 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.)
1998-08-25 12:29:08 +00:00
Guido van Rossum 5fdf85254c Patch by Chris Herborth (posted to comp.lang.python)to make it behave
with tags that have - or . in their names.
1998-08-24 20:59:13 +00:00
Guido van Rossum 747e1cade6 Should pass explicit arguments to findtests(). Should initialize 'nottests'. 1998-08-24 13:48:36 +00:00
Andrew M. Kuchling 9a80e00cac 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().
1998-08-21 18:39:38 +00:00
Fred Drake ce4ba897be 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.
1998-08-18 17:43:08 +00:00
Jeremy Hylton 31bb8cef2c 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.
1998-08-13 19:57:46 +00:00
Guido van Rossum 4365cabf3c Add Tim Peters' test for long ints 1998-08-13 14:20:17 +00:00
Guido van Rossum e03c050595 The usual. 1998-08-12 02:38:11 +00:00
Guido van Rossum 3d16d3e643 Fredrik Lundh's font wrapper. 1998-08-11 19:07:58 +00:00
Guido van Rossum b4750db3b3 Added coords() and identify() methods to Scale class. 1998-08-11 19:07:14 +00:00
Guido van Rossum be21d98cee Use repr() on the filename in EnvironmentError.__str__(). This
displays funny characters, like spaces or control characters, more
clearly (one of my pet peeves in error messages).  Also only suppress
the filename if it is None; display it if it is '', since that would
be a genuine (illegal) filename passed in!
1998-08-11 18:01:32 +00:00
Guido van Rossum df23ef4763 Guess what -- BSD has bifurcated again. :-( 1998-08-11 16:21:04 +00:00
Guido van Rossum 9279ec2504 On the mac, shouldn't change the creator+type of the *source* file! 1998-08-11 14:13:44 +00:00
Guido van Rossum 3da987c292 Checking in BeOS specific socket module. 1998-08-10 20:15:32 +00:00
Guido van Rossum 2b427c74e1 Nannified. 1998-08-10 20:13:17 +00:00
Guido van Rossum 27d445f59e Nannified, and re-indented with 4 spaces. 1998-08-10 20:12:34 +00:00
Guido van Rossum cc221c470f Fixed a few lines that tabnanny complained about (one space before the
tabs).
1998-08-10 20:07:53 +00:00
Guido van Rossum 2880f6ec95 Untabified and deleted trailing blank lines. 1998-08-10 20:07:00 +00:00
Guido van Rossum 449fdf1d76 The doc string for setDaemon() disagreed with the implementation. The
implementation wins.
1998-08-07 19:15:20 +00:00
Guido van Rossum d89fa0c576 Add built-in string variables 'quit' and 'exit' that display a hint on
how to exit (in a platform dependent way!).  We use os.sep to
determine which platform we're on, since I expect that this will work
better for minority platforms.
1998-08-07 18:01:14 +00:00
Guido van Rossum 2c2f731daf [Sjoerd Mullender]
Don't use CL module since all constants are now in cl.
1998-08-07 15:28:23 +00:00
Guido van Rossum 1015be3812 [Sjoerd Mullender]
Fixed infinite loop when a message ends prematurely in some
circumstances.
1998-08-07 15:26:56 +00:00
Guido van Rossum 5ff1761d3f From: "Fredrik Lundh" <fredrik@pythonware.com>
Date: Fri, 7 Aug 1998 13:37:12 +0100

the "initialcolor" code is broken in several places in the
current version of tkColorChooser.  I've attached an up-
dated version for 1.5.2.
1998-08-07 14:55:21 +00:00
Barry Warsaw 6446212593 Time machine experiment. Use '__name__' as the special key (always
present) that refers to the section name.  Also added a (slightly)
better InterpolationError error message, which includes the raw
string.
1998-08-06 18:48:41 +00:00
Guido van Rossum 4163e708ed On the Mac, use Internet Config to find the proxies (Jack Jansen).
Also added two XXX comments about lingering thread unsafeness.
1998-08-06 13:39:09 +00:00
Guido van Rossum 4ff6d27319 Quote/unquote slashes in macintosh pathname components (Jack Jansen). 1998-08-06 13:37:21 +00:00
Guido van Rossum de23cb0e7e Bug in how an except statement was written (submitted by Piers himself). 1998-08-06 02:59:07 +00:00
Guido van Rossum da4d6daa4a Support case insensitive treatment of os.environ keys on Windows and
DOS (as well as OS/2).  I presume that making a call to putenv() with
a lowercase key will actually do the right thing.  I know this is so
on Windows/DOS, and I expect it is so OS/2 -- but the old OS/2 code
didn't assume this.  (I don't know if the person who provided the OS/2
patch was clueless or just didn't care about DOS and Windows.)

Also ripped out the support for pickling -- as of 1.5, this is no
longer needed to make pickling work.
1998-08-04 16:01:23 +00:00
Guido van Rossum fcfb6323fb Latest version by The Dragon, who writes:
I did some bugfixes, and fixed a major problem with the esmtp suport (I
think the person who did that part misunderstood RFC1869) Some of the
interface fer esmtp-related things has changed as a result.

I also added some documentation to the SMTP class' docstring.
1998-08-04 15:29:54 +00:00
Guido van Rossum 84c6fc9653 Patch by Ron Klatchko: fix invariant in _unread(). Also fixed
readlines() to behave like it should (return lines with "\n" appended).
1998-08-03 15:41:39 +00:00
Guido van Rossum 6fd83b7b38 Generalized so it's useful for testing other packages, by Andrew
Kuchling @ CNRI.
1998-08-01 17:04:08 +00:00
Guido van Rossum 3357561476 Added randrange to list of exported functions. 1998-07-31 13:40:05 +00:00
Guido van Rossum 187f154243 Introducing randrange([start,] stop [,step]) -- same as
choice(range(start, stop, step)) but faster.  This addresses the
problem that randint() was accidentally defined as taking an inclusive
range (how unpythonic).

The code is longish because Tim Peters insisted that it reject
non-integral arguments while I insisted that it be not much slower
than randint(); the compromise satisfies both but is somewhat
convoluted.

Also changed randint() to be implemented through randrange().  This is
a semantic change because old randint() didn't test its arguments for
validity.  (It also makes randrange() win any contest with randint()
:-)
1998-07-31 13:39:44 +00:00
Guido van Rossum 1a7bab05e8 Don't use raw_input() to ask for the password; this puts the password
in the GNU readline history buffer which is not such a great idea.
1998-07-28 19:28:43 +00:00
Jeremy Hylton ec8c8c2ef2 fix __str__ method of EnvironmentError (base class of IOError): was
using "%d" % errno to print out IOError exceptions -- but urllib.py
raises exceptions where the errno slot in the exception tuple is a
string.
1998-07-28 17:30:06 +00:00
Guido van Rossum 2bc1f8f07e Added getsize(), getmtime(), getatime() 1998-07-24 20:49:26 +00:00
Guido van Rossum 4def7de7c6 Add makedirs(), removedirs(), renames() -- ESR-inspired super-versions
of mkdir(), rmdir() and rename() that make or remove intermediate
directories as well.
1998-07-24 20:48:03 +00:00
Barry Warsaw 2dfe4de614 Added support for including the filename in IOErrors and OSErrors that
involve a filesystem path.  To that end:

- Changed IOError to EnvironmentError and added a hack which checks
  for arg of len 3.  When constructed with a 3-tuple, the third item
  is the filename and this is squirreled away in the `filename'
  attribute.   However, for in-place unpacking backwards
  compatibility, self.args still only gets the first two items.  Added
  a __str__() which prints the filename if it is given.

- IOError now inherits from EnvironmentError

- New class OSError which also inherits from EnvironmentError and is
  used by the posix module.
1998-07-23 16:03:46 +00:00
Guido van Rossum 810a3396d1 Speed up the implementation of quote().
Fix the implementation of quote_plus().  (It wouldn't treat '+' in the
original data right.)

Add urlencode(dict) which is handy to create the data for sending a
POST request with urlopen().
1998-07-22 21:33:23 +00:00
Guido van Rossum 1f00eed8b5 Feature added by Harri Pasanen (at my suggestion): .py suffix on
filename may be omitted.
1998-07-22 13:35:21 +00:00
Guido van Rossum 052969a602 Don't use calculations on values gotten from tell(). Also use a
slightly different way to test for the existence of unread.
1998-07-21 14:24:04 +00:00
Guido van Rossum 136a112bf1 Untabified. 1998-07-20 23:22:51 +00:00
Guido van Rossum f60e8e8108 Update the documentation. Get rid of the section "how it works"
(which is not very relevant when you're in the debugger :-).
1998-07-20 23:21:21 +00:00
Guido van Rossum b5699c7240 Added support for specifying a filename for a breakpoint, roughly
according to an idea by Harri Pasanen (but with different syntax).
This affects the 'break' and 'clear' commands and their help
functions.  Also added a helper method lookupmodule().

Also:

- Try to import readline (important when pdb is used from/as a script).
- Get rid of reference to ancient __privileged__ magic variable.
- Moved all import out of functions to the top.
- When used as a script, check that the script file exists.
1998-07-20 23:13:54 +00:00
Guido van Rossum c612681b20 Fix another bug in ESR's changes. In order to work properly,
onecmd(line) must return the value returned by emptyline() or
default(line).
1998-07-20 21:22:08 +00:00
Guido van Rossum 0aec9fb183 Add missing initializer for self._backupfilename. Due to Ralph Butler. 1998-07-20 15:49:28 +00:00
Guido van Rossum 3a8d1f5a6b Modest speed improvement to escape() by Piet van Oostrum. 1998-07-20 15:46:13 +00:00
Guido van Rossum 7333c4cafc Patch by Piet van Oostrum to avoid calculating with the result of
fp.tell() -- that won't work on Windows.

(A patch for rfc822 is still needed for one case where it finds a bad
header line and wants to back up.)
1998-07-20 15:24:01 +00:00
Guido van Rossum bd9f093fcd Measure performance of sub(), split(), findall(). 1998-07-17 21:10:42 +00:00
Guido van Rossum 0e5ab17ad3 Get a 3- to 4-fold speedup for sub()/subn(), split() and findall() by
not calling self.search(); instead, call self.code.match() directly
and interpret the list of registers it returns directly.  This saves
the overhead of instantiating a MatchObject for each hit, basically
inlining search() as well as group().  When a MatchObject is still
needed, one is allocated and reused for the duration of the scan.
1998-07-17 20:18:49 +00:00
Guido van Rossum c364cf8228 Added tests for findall().
Added test for m.groups() with default.
Added a few prints announcing various tests in verbose mode.
1998-07-17 20:05:02 +00:00
Guido van Rossum 7f1d3aa3d9 Add tests for array self-assigns. (This one has no relevance to JPython.) 1998-07-16 15:31:43 +00:00
Guido van Rossum affd77f71e Add tests for list self-assigns. (Sorry, this should have been here
before JPython 1.0 came out.)
1998-07-16 15:29:06 +00:00
Guido van Rossum 93d1fe1c56 From: Nicolas CHAUVAT <nico@caesium.fr>
In the bbox method of Group (Canvas.py file), you should read

	return self.canvas._getints(self._do('bbox'))

instead of

	return self._getints(self._do('bbox'))
1998-07-16 13:43:05 +00:00
Fred Drake 182c590869 Tk.__init__(): In computing baseName, add ".pyo" to list of dropped
extensions, and include the "." in ".pyc".  Still need to get
	_tkinter.c:Tkapp_New() to use baseName....
1998-07-15 04:36:56 +00:00
Guido van Rossum 69a79bca68 Better RFC 821 compliance (MAIL and RCPT, and CRLF in data)
by Carey Evans <c.evans@clear.net.nz>, for picky mail servers.
1998-07-13 15:18:49 +00:00
Guido van Rossum eeb64287f1 (1) Added a sys.exc_info() emulation. (It returns None for the traceback.)
(2) Made the test script a bit fancier -- you can now use it to run
arbitrary scripts in restricted mode, and it will do the right thing.
(The interactive mode is still pretty lame; should integrate this with
code.interact().)
1998-07-09 13:52:38 +00:00
Guido van Rossum b84ef9bc61 Put back the call to report_unbalanced() that was lost when
parse_endtag() was restructured in parse_endtag() and finish_endtag().
1998-07-07 22:46:11 +00:00
Guido van Rossum 9d865e1a30 Get rid of some obsolete opcodes. 1998-07-07 14:58:39 +00:00
Guido van Rossum 9f2b524385 The permissions ('mode' flag) should default to 0666. 1998-07-03 14:16:55 +00:00
Guido van Rossum 8ba4036a40 The _fromlinepattern was a little too restrictive -- some sendmails
don't put the seconds in the time!
1998-07-02 23:05:32 +00:00
Guido van Rossum 6bbd1d0f0e According to Robin Dunn, at least one FTP server returns 200 instead
of 250 on a successful delete.
1998-07-02 20:41:20 +00:00
Guido van Rossum 030eb11823 Gotta have an __init__() method -- pdb.py calls it! 1998-07-01 22:53:04 +00:00
Barry Warsaw bfa3f6b673 Several changes:
1. Convert to using re module

2. Added two new exception classes

    a. MissingSectionHeaderError which signals an early parsing
       exception when options appear in the file before any section
       header.  Previously a bogus TypeError was thrown deeper down.

    b. ParsingError which collates any non-fatal parsing errors.
       ConfigParser.read() will raise this after the entire file was
       parsed if any errors occurred during parsing (client could just
       catch the exception and continue, because the ConfigParser
       instance would still be initialized with the valid data).

   (small note: Error.__msg => Error._msg)

3. ConfigParser.__read() now uses re which has the following minor
   semantic change: underscore is now allowed in section header and
   option name.  Also, because of the old regexps, theoretically.
   Fixed continuation line bug reported by F. Lundh.

4. It seemed that the old ConfigParser automatically added the option
   `name' to every section, which contained the name of the section.
   This seemed bogus to me so I took it out.
1998-07-01 20:41:12 +00:00