Commit Graph

2171 Commits

Author SHA1 Message Date
Guido van Rossum 2f7df12f33 Patch by Paul Sokolovsky to support the get() method. 1999-08-11 01:54:05 +00:00
Greg Ward abc2f960d4 Allow comment characters (#) to be escaped:
- did away with 'comment_re' option -- it's just not that simple anymore
  - heavily revised the main logic in 'readline()' to accomodate this
Beefed up 'warn()': 'line' can be list or tuple, and 'msg' is
  automatically converted to a string.
1999-08-10 20:09:38 +00:00
Andrew M. Kuchling 916fcc3b18 Added __del__ method to GzipFile class that will flush and close the
object, if required.
1999-08-10 13:19:30 +00:00
Guido van Rossum a74c55662f Mark Hammond writes:
"""
If the filename being complained about contains a space, enclose the
file-name in quotes.

The reason is simply that when I try and parse tabnanny's output, filenames
with spaces make it very difficult to determine where the filename stops
and the linenumber begins!
"""

Tim approves.

I slightly changed the patch (use 'in' instead of string.find()) and
arbitrarily bumped the __version__ variable up to 6.
1999-07-30 17:48:20 +00:00
Guido van Rossum 42b334d93d Remove some redundant code from Canvas.tag_bind(), which added all
bindings to a dictionary _tagcommands which was otherwise unused.
(This was checked in accidentally with rev. 1.125 and not deleted with
rev. 1.127 when the other half of this code was removed -- although
even as originally checked in the _tagcommands variable was never
used.)

(PR#40, reported by Peter Stoehr)
1999-07-30 12:22:12 +00:00
Guido van Rossum 2ab455a8fa Another patch from Andy Dustman:
"""
Here's a patch for the ForkingMixIn which will prevent the server from
forking itself into the ground. Note: I've tested a very similar patch
(subclassed ForkingMixIn) but not actually tested this one. As you might
surmise, this was done out of necessity...

If the maximum number of children are already running, block while waiting
for a child to exit.
"""

(I added that last sentence as a comment to the code --GvR.)
1999-07-28 21:39:28 +00:00
Fred Drake 69f87c580d getsize(), getatime(), getmtime():
Constants from stat module were imported using "import *";
	don't access them via stat.ST_*!

	Reported by that other vR.  ;-)
1999-07-23 15:04:05 +00:00
Guido van Rossum ba508a21e0 Add test case for bug just fixed by Stephen Turner. 1999-07-13 15:23:42 +00:00
Barry Warsaw 7c5b9d1fa9 added a test for "To: :" patch 1999-07-12 18:47:00 +00:00
Barry Warsaw 96e9bf45e8 AddrlistClass.getaddress(): when parsing `:'s, in the loop, watch out
for gotonext() pushing self.pos past the end of the string.  This can
happen if the message has a To field like "To: :" and you call
msg.getaddrlist('to').
1999-07-12 18:37:02 +00:00
Greg Ward 170bdc08e1 The first concrete subclass of CCompiler: defines a barebones Unix C compiler. 1999-07-10 02:04:22 +00:00
Greg Ward 3f81cf7936 The abstract base class that defines the C/C++ compiler abstraction model. 1999-07-10 02:03:53 +00:00
Greg Ward ba3f108ec0 Added a self-berating command relating to installation directories for
module distributions that contain platform-specific files.
1999-07-10 02:02:31 +00:00
Greg Ward ccbb3f0ed4 Don't pollute importer's namespace with type objects from types modules.
Added DistutilsPlatformError.
1999-07-10 02:01:44 +00:00
Guido van Rossum 6ebb387a08 Patch by Jeffrey Chang to add docstrings everywhere.
The text is condensed from the library manual.
1999-07-09 21:15:32 +00:00
Fred Drake d5f173bf1f FTP.dir(): Fix typo in docstring. 1999-07-07 13:36:59 +00:00
Guido van Rossum 3427c1f71b Sjoerd Mullender:
In splithost, accept empty host part in URLs.  This is required for
file URLs that can have an empty host part.  For such URLs, we should
not return the initial 2 slashes as part of the file name.
1999-07-01 23:20:56 +00:00
Fred Drake b5879ca2e9 Relocating file to Lib/lib-old. 1999-07-01 16:59:29 +00:00
Fred Drake b8690fbc95 Define NotANumber as a subclass of ValueError when using class-based
exceptions.

When raising NotANumber, pass the string that failed as the exception
value.
1999-06-29 15:49:35 +00:00
Fred Drake 5c4012adc0 While we're at it, convert to docstrings and set the indentation level
to 4.
1999-06-25 18:53:23 +00:00
Guido van Rossum 7ea8f8404c Break some cycles when the widget is destroyed. 1999-06-25 15:53:54 +00:00
Fred Drake 624a191512 Patch from Sjoerd Mullender:
Make argument names equal to what is used in the documentation of the
file object, since chunks are supposedly file-like.
1999-06-25 14:58:44 +00:00
Guido van Rossum 59834f11e3 Mikael Lyngvig writes:
I just noticed that the changes below also apply to cmpcache.py, which
is virtually identical to cmp.py.
1999-06-25 14:21:44 +00:00
Guido van Rossum 3aa9ca147b Patch by Mikael Lyngvig:
1. Fix incorrect file open mode on Win32 platforms (use "rb" instead
of "r").

2. Add shallow parameter to cmp.cmp().  If false, deep file
comparisons are made.

The module should be 100 percent backwards compatible.
1999-06-25 14:12:50 +00:00
Guido van Rossum 336a201d4f Sjoerd Mullender writes:
Urllib makes the URL of the opened file available through the geturl
method of the returned object.  For local files, this consists of
file: plus the name of the file.  This results in an invalid URL if
the file name was relative.  This patch fixes this so that the
returned URL is just a relative URL in that case.  When the file name
is absolute, the URL returned is of the form file:///absolute/path.

[I guess that a URL of the form "file:foo.html" is illegal...  GvR]
1999-06-24 15:27:36 +00:00
Guido van Rossum ff3a278d3b Small patch by Tim Peters - it was using self.maxlist when it should
be using self.maxdict.
1999-06-23 23:27:05 +00:00
Fred Drake 4316135a44 Make the mode parameter to open() default in the same way as for wave.open(). 1999-06-22 21:23:23 +00:00
Guido van Rossum 8746082175 Patch by Tim Peters:
Introduce a new builtin exception, UnboundLocalError, raised when ceval.c
tries to retrieve or delete a local name that isn't bound to a value.
Currently raises NameError, which makes this behavior a FAQ since the same
error is raised for "missing" global names too:  when the user has a global
of the same name as the unbound local, NameError makes no sense to them.
Even in the absence of shadowing, knowing whether a bogus name is local or
global is a real aid to quick understanding.

Example:

D:\src\PCbuild>type local.py
x = 42

def f():
    print x
    x = 13
    return x

f()

D:\src\PCbuild>python local.py
Traceback (innermost last):
  File "local.py", line 8, in ?
    f()
  File "local.py", line 4, in f
    print x
UnboundLocalError: x

D:\src\PCbuild>

Note that UnboundLocalError is a subclass of NameError, for compatibility
with existing class-exception code that may be trying to catch this as a
NameError.  Unfortunately, I see no way to make this wholly compatible
with -X (see comments in bltinmodule.c):  under -X, [UnboundLocalError
is an alias for NameError --GvR].

[The ceval.c patch differs slightly from the second version that Tim
submitted; I decided not to raise UnboundLocalError for DELETE_NAME,
only for DELETE_LOCAL.  DELETE_NAME is only generated at the module
level, and since at that level a NameError is raised for referencing
an undefined name, it should also be raised for deleting one.]
1999-06-22 14:47:32 +00:00
Guido van Rossum 1a03cf56e0 Greg McFarlane submitted two missing Text methods: mark_next() and
mark_previous().
1999-06-21 14:13:30 +00:00
Fred Drake 4f298695be Relocating file to Lib/lib-old. 1999-06-18 17:12:36 +00:00
Guido van Rossum 9e480adf9b Patch suggested (and partially provided) by Lars Damerow: instead of
always lowercasing the option name, call a method optionxform() which
can be overridden.  Also make the regexps SECTRE and OPTRE non-private
variables so they can also be overridden.
1999-06-17 18:41:42 +00:00
Guido van Rossum bfadac00ef In collect_children(), put a try-except around os.waitpid() because it
may raise an exception (when there are no children).  Reported by
Andy Dustman.
1999-06-17 15:41:33 +00:00
Fred Drake f9607821ad open(): Make the mode parameter optional; if omitted or None, use the
mode attribute of the file object (if it has one), otherwise
	 use 'rb'.

	 The documentation should still show this as required until
	 there's a new release.
1999-06-17 15:18:47 +00:00
Guido van Rossum 9f612f9c5a Suppress warning print statements about modules not found, they are
confusing to end users of IDEs.
1999-06-16 12:28:12 +00:00
Guido van Rossum 7bb11d68bf Sjoerd Mullender:
Added support for unseekable files.

(I use unqualified excepts since we don't know why the seek/tell might
fail.  In my case it was because of an AttributeError.)
1999-06-16 12:25:34 +00:00
Guido van Rossum f2f0594587 Laurence Tratt notes that the accept() call in get_request() can fail,
and suggests putting a try/except around the get_request() call in
handle_request().  (All in class TCPServer.)
1999-06-15 22:25:32 +00:00
Guido van Rossum 47ac4e6b41 Add the test case provided by Barry Scott for his patch. 1999-06-15 18:56:46 +00:00
Guido van Rossum b184487055 Barry Scott writes:
Problem: rfc822.py in 1.5.2 final loses the quotes around
quoted local-part names.

The fix is to preserve the quotes around a local-part
name in an address.

Test:

	import rfc822
	a = rfc822.AddrlistClass('(Comment stuff) "Quoted
name"@somewhere.com')
	a.getaddrlist()

The correct result is:

	[('Comment stuff', '"Quoted name"@somewhere.com')]
1999-06-15 18:06:20 +00:00
Barry Warsaw 6e1d78a181 Added a couple of endswith test cases for bugs reported by Timbot.
Also added a short circuit for the regression test suite since CVS
insisted on putting this file in the main branch. :(
1999-06-15 16:49:11 +00:00
Barry Warsaw d5258681e7 Added more tests of join 1999-06-14 18:38:42 +00:00
Fred Drake cbfa5cbcc8 Message.getheaders(): If there are no matching headers, return an
empty list instead of None.  (Guido's request.)
1999-06-14 15:40:23 +00:00
Guido van Rossum 60a3bd8130 After more discussion with Jim, change the behavior so that only a
*missing* content-type at the outer level of a POST defaults to
urlencoded.  In all other circumstances, the default is read_singe().
1999-06-11 18:26:09 +00:00
Barry Warsaw 122473fc70 Two extra startswith tests 1999-06-11 17:51:13 +00:00
Barry Warsaw 8a9514a660 Harness can now test object methods directly, if they aren't available
in the string module.

Add a bunch of new tests for extended startswith/endswith arguments.
1999-06-11 17:48:07 +00:00
Guido van Rossum 18df5d479c Mark Hammond: patch for Windows/CE. 1999-06-11 01:37:27 +00:00
Barry Warsaw 4afdb0a89a Output for the regression test of the new string methods. 1999-06-10 22:53:23 +00:00
Barry Warsaw 50f0e16d1b Regression test for the new string methods. 1999-06-10 22:53:10 +00:00
Fred Drake 2b755b88c0 Relocating file to Lib/lib-old. 1999-06-10 21:18:02 +00:00
Guido van Rossum b269302695 Added a few more bugs to the doc string; reformatted existing bugs. 1999-06-10 19:05:54 +00:00
Guido van Rossum a3b4a33f3b Co-production with Tim Peters, implementing a suggestion by Mark
Hammond: record top-level functions (as Function instances, a simple
subclass of Class).  You must use the new interface readmodule_ex() to
get these, though.
1999-06-10 14:39:39 +00:00
Guido van Rossum 3d548717f5 Fix by Sjoerd for a package related bug: If you have a non-empy
__init__.py it isn't read.  (Sjoerd just came up with this, so it's
not heavily tested.)

Other (yet unsolved) package problems noted by Sjoerd:

- If you have a package and a module inside that or another package
  with the same name, module caching doesn't work properly since the
  key is the base name of the module/package.
- The only entry that is returned when you readmodule a package is a
  __path__ whose value is a list which confuses certain class browsers
  that I wrote.  (Hm, this could be construed as a feature.)
1999-06-09 15:49:09 +00:00
Guido van Rossum 0dee4ee0f8 Updated lagging version#. Also added some comments about how quote()
and quote_plus() can be optimized tenfold.
1999-06-09 15:14:50 +00:00
Guido van Rossum db23d3dbf7 Patch by Per Cederqvist:
I've found two places where smtplib.py sends an extra trailing space
on command lines to the SMTP server.  I don't know if this ever causes
any problems, but I'd prefer to be on the safe side.  The enclosed
patch removes the extra space.
1999-06-09 15:13:10 +00:00
Guido van Rossum b39aff87f7 Add unrelated but handy function: timegm(), to calculate Unix
timestamp from GMT tuple.
1999-06-09 15:07:38 +00:00
Guido van Rossum 145a5f73f0 Don't just die if gethostbyaddr() fails -- as it can when DNS is
unreachable -- but fall back to using whatever hostname we have.
1999-06-09 15:05:47 +00:00
Guido van Rossum 56b20595e6 Oops, Sjoerd was in a hurry. This patch from him fixes some length
math in the Chunk class.
1999-06-09 13:41:18 +00:00
Guido van Rossum 8ea7bb8e78 Patch/new code by Sjoerd Mullender:
Separate the Chunk class out of the aifc module into a new "chunk" module.
1999-06-09 13:32:28 +00:00
Guido van Rossum 1f2e09bc45 Fix (sanctioned by Sjoerd) for a problem reported by Andreas Faerber:
all processing instruction target names containing 'xml' were
rejected, instead (as the standard rejects) only the name 'xml' itself
(or case variants thereof).
1999-06-08 21:23:26 +00:00
Greg Ward 5116f90ece On David Ascher's recommendation: reversed order of 'utime()' and
'chmod()' in 'copy_file()'.
1999-06-08 17:05:21 +00:00
Guido van Rossum a8d0f4fd2d Sam's latest versions 1999-06-08 13:20:05 +00:00
Guido van Rossum cf09a3924f Skip Montanaro:
I guess in 1.5.2 a new module, whichdb, was added that attempts to
divine the nature of a database file.  This module doesn't know anything
about Berkeley DB v2 files.  In v2, Sleepycat added a 12-byte null pad
in front of the old magic numbers (at least for hash and btree files).
I've been using v2 for awhile and upgrading to 1.5.2 broke all my
anydbm.open calls. I believe the following patch corrects the problem.
1999-06-08 13:13:16 +00:00
Guido van Rossum df9f7a3e52 Tim Peters: Taught it more "real Python" rules without slowing it
appreciably.  Triple-quoted strings no longer confuse it, nor nested
classes or defs, nor comments starting in column 1.  Chews thru
Tkinter.py in < 3 seconds for me; doctest.py no longer confuses it; no
longer missing methods in PyShell.py; etc.  Also captures defs
starting in column 1 now, but ignores them; an interface should be
added so that IDLE's class browser can show the top-level functions
too.
1999-06-08 12:53:21 +00:00
Greg Ward 9a33707be7 Hacked 'set_final_options()' to set (hopefully) appropriate values for
'install_site_lib' and install_site_platlib' on non-POSIX platforms.
Should at least work for NT, as this is adopted from Amos Latteier's NT
patches.  Also added extensive comments bitching about the inadequacy of
the current model, both under POSIX and NT (and probably other) systems.
1999-06-08 02:04:36 +00:00
Greg Ward c997334977 Added the 'have_run' dictionary to Distribution, and changed
'run_command()' to refer to it before attempting to run a command --
  that way, command classes can freely invoke other commands without fear
  of duplicate execution.
Beefed up some comments and docstrings.
1999-06-08 02:02:00 +00:00
Greg Ward 4d74d73b07 Now handles NT, through '_init_nt()' function (courtesy of
Amos Latteier <amos@aracnet.com>).
1999-06-08 01:58:36 +00:00
Guido van Rossum ad380551f6 Experimental speedup patch by Tim Peters (please test!):
It wasn't hard to speed pyclbr by a factor of 3, and I'll attach an
experimental patch for that (experimental because barely tested).  Uncomment
the new "String" stuff and it will deal with strings correctly (pyclbr
currently ignores the possibility), but that slows it down a lot.  Still
faster in the end than current pyclbr, but-- frankly --I'd rather have the
dramatic speedup!
1999-06-07 15:25:18 +00:00
Guido van Rossum 1946f0d6f2 Patch by Jim Fulton: new function parse_qsl(), which is like
parse_qs() but returns a list of (name, value) pairs -- which is
actually more correct.  Use this where it makes sense.
1999-06-04 17:54:39 +00:00
Guido van Rossum ce900defc5 At Jim Fulton's request (actually, as a compromise :-), default the
content-type to application/x-www-form-urlencoded only when the method
is POST.  Ditto for when the content-type is unrecognized -- only
fall back to urlencoded with POST.
1999-06-02 18:44:22 +00:00
Guido van Rossum 198e7cac5a Andy Dustman notes that I patched the close() call in the wrong place.
Here's the correct patch!
1999-06-01 18:58:34 +00:00
Guido van Rossum 6b708d569c In class TemporaryFileWrapper, don't cache attributes of tpye int --
these happen to be 'closed' and 'softspace', which may change!

Noted by Dave Ascher (with slightly different solution).
1999-06-01 18:55:36 +00:00
Guido van Rossum 116b31bed7 Jack Jansen's patch to support file:///path/file/name URL syntax. 1999-06-01 14:36:56 +00:00
Guido van Rossum fa8c3eab79 Greg McFarlane writes: Tkinter.Text.tag_add should take multiple
arguments.  [Slightly changed from submitted patch.]
1999-06-01 13:57:15 +00:00
Guido van Rossum 18659608dc Andy Dustman writes:
I noticed while watching (with lsof) my forking SocketServer app running
that I would get multiple processes listening to the socket. For the most
part, this doesn't hurt things, but if you terminate the server, this can
prevent it from restarting because it cannot bind to the port due to any
running children which also have the socket open. The following one-liner
fixes this.
1999-05-21 16:12:30 +00:00
Fred Drake c40c54782c Map .js to application/x-javascript. 1999-05-20 12:52:04 +00:00
Fred Drake 361c048b8f POP3.uidl(): Update docstring based on comments from Piers Lauder
<piers@cs.su.oz.au>.
1999-05-13 18:47:25 +00:00
Guido van Rossum 8e40759d5a Nathan Paul Simons noticed that the grid_remove() method was missing.
(The difference between grid_remove() and grid_forget() is that the
former remembers the options for the slave.)
1999-05-05 23:03:48 +00:00
Guido van Rossum 3ed1be9fbd Regression test for date format code, by Mike Meyer.
(I tweaked it slightly so examples are allowed to have no date too.)
1999-05-03 19:57:01 +00:00
Guido van Rossum 4f13669cf0 No need to import find(). (Andrew Dalke & kjpylint) 1999-05-03 18:16:23 +00:00
Guido van Rossum 73898c7b15 No need to import os or string. (Andrew Dalke & kjpylint) 1999-05-03 18:14:16 +00:00
Guido van Rossum 96d80f984a No need to import sys. (Andrew Dalke & kjpylint) 1999-05-03 18:13:51 +00:00
Guido van Rossum 138bdafa8d Typo. (Andrew Dalke, without kjpylint) 1999-05-03 18:13:29 +00:00
Guido van Rossum 6952f17f31 No need to import string. (Andrew Dalke & kjpylint) 1999-05-03 18:13:00 +00:00
Guido van Rossum ff3932abcd No need to import os in test(). (Andrew Dalke & kjpylint) 1999-05-03 18:12:36 +00:00
Guido van Rossum 699f3bbba3 Get rid of confusing 'global' statement in global code.
(Andrew Dalke & kjpylint)
1999-05-03 18:12:08 +00:00
Guido van Rossum 1e1cfa3a1c No need to import sys or string. (Andrew Dalke & kjpylint) 1999-05-03 18:10:37 +00:00
Guido van Rossum 1cc2b9de35 Clarify why we define disco. Suggested by Andrew Dalke. 1999-05-03 18:09:53 +00:00
Guido van Rossum 287b3996d5 Clarify why we define error. Suggested by Andrew Dalke. 1999-05-03 18:09:26 +00:00
Guido van Rossum db6d12c498 No need to import sys or linecache. (Andrew Dalke & kjpylint) 1999-05-03 18:08:16 +00:00
Guido van Rossum 00245cfbaa No need to import gmtime, ctime, asctime.
Make error an alias for ValueError.
(Andrew Dalke & kjpylint)
1999-05-03 18:07:40 +00:00
Guido van Rossum 92b44517cb Clarify why there are dynamic imports in AudioDev().
This will enlighten Andrew Dalke; I don't know about kjpylint. :-)
1999-05-03 18:04:07 +00:00
Guido van Rossum 5c071fab8f The _comp_data() function never worked, it contained a reference to
undefined 'nframes'.  Should be self._nframes.  (Andrew Dalke & kjpylint)
1999-05-03 18:02:44 +00:00
Guido van Rossum f8fd11d039 No need to import sys, time, socket or SocketServer. (Andrew Dalke & kjpylint) 1999-05-03 18:01:31 +00:00
Guido van Rossum 3a64e058eb No need to import sys, time, or socket. (Andrew Dalke & kjpylint) 1999-05-03 18:00:48 +00:00
Guido van Rossum e6e8818c03 No need to import rfc822. (Andrew Dalke & kjpylint) 1999-05-03 18:00:20 +00:00
Guido van Rossum b46413f274 The case-insensitive _Environ class was lacking a case-insensitive has_key(). 1999-05-03 15:23:24 +00:00
Greg Ward 884df454b2 The 'copy_file()' and 'copy_tree()' functions in util.py now have
meaningful return values: respectively, whether the copy was done, and
the list of files that were copied.  This meant some trivial changes in
core.py as well: the Command methods that mirror 'copy_file()' and
'copy_tree()' have to pass on their return values.
1999-05-02 21:42:05 +00:00
Greg Ward 0f72695da3 Rearranged things so that compilation of .py files is the responsibility
of the 'install_py' command rather than 'build_py'.  Obviously, this
meant that the 'build_py' and 'install_py' modules had to change; less
obviously, so did 'install' and 'build', since these higher-level
commands must make options available to control the lower-level
commands, and some compilation-related options had to migrate with the
code.
1999-05-02 21:39:13 +00:00
Guido van Rossum b08f51b93a Mike Meyer reports a bug in his patch (several months ago) that
accepts long month names.  One essential line was missing.  Fixed now.
1999-04-29 12:50:36 +00:00
Fred Drake ddf22c4243 Message.getheader(): Fixed grammatical error in docstring.
Message.getheaders():  Method to get list of all values for each
		       instance of a named header.  See docstring for more.
1999-04-28 21:17:38 +00:00
Fred Drake 5712fa9250 Added test case that includes a comma in the full name. This tests
for an old bug that's been gone a while, but was still documented
until a few minutes from now.
1999-04-28 17:38:31 +00:00
Guido van Rossum 630b811676 Two changes suggested by Jan Pieter Riegel:
(1) Fix reference to pwd.error to be KeyError -- there is no pwd.error
and pwd.getpwnam() raises KeyError on failure.

(2) Add cookie support, by placing the 'Cookie:' header, if present,
in the HTTP_COOKIE environment variable.
1999-04-28 12:21:47 +00:00
Guido van Rossum 3f36a085fe Cast f.tell() result to int() in _addval(), so it works even on
platforms where tell() returns a long.  (Perhaps tell() should be
fixed too?)  Reported by Greg Humphreys.
1999-04-27 12:21:17 +00:00
Guido van Rossum 20c92283ab Patch by Per Cederqvist, seemingly approved by The Dragon:
Two problems: The SMTPRecipientsRefused class should not inherit
SMTPResponseException, since it doesn't provide the smtp_code and
smtp_error attributes.  My patch for not adding an extra CRLF was
apparently forgotten.  The enclosed patch fixes these two problems.
1999-04-21 16:52:20 +00:00
Guido van Rossum 068d5724d8 Calling _cleanup() does not guarantee that all processes have
terminated; this makes the final assert in the self-test code fail if
the parent runs faster than the children.  Fix this by calling wait()
on the remaining children instead.
1999-04-20 12:27:31 +00:00
Guido van Rossum 247a78a10d Utility function that yields a properly formatted time string.
(Idea by Jeff Bauer, code by Jeremy, renamed and "Date:" constant
stripped from return value by GvR.)
1999-04-19 18:04:38 +00:00
Fred Drake f340114d72 Relocating file to Lib/lib-tk. 1999-04-19 18:03:57 +00:00
Guido van Rossum 0cf46bc0f4 Daniel Neri: OpenBSD is just as BSD'ish as the other BSD's ;-) 1999-04-19 17:22:12 +00:00
Greg Ward 4e5a7c7056 'warn()' method now takes an optional line number. 1999-04-15 17:50:19 +00:00
Guido van Rossum dabcd0040c Fix mysterious references to jprofile that were in the source since
its creation.  I'm assuming these were once valid references to "Jim
Roskind's profile"...
1999-04-13 04:24:22 +00:00
Guido van Rossum ba3ed56a22 Removed; since long subsumed in Doc/lib/libthreading.tex 1999-04-13 04:20:48 +00:00
Guido van Rossum 0fe110548d Forgot to add this file. CDROM device parameters. 1999-04-12 14:35:08 +00:00
Guido van Rossum 95bdd0b604 Two different changes.
1. Jack Jansen reports that on the Mac, the time may be negative, and
solves this by adding a write32u() function that writes an unsigned
long.

2. On 64-bit platforms the CRC comparison fails; I've fixed this by
casting both values to be compared to "unsigned long" i.e. modulo
0x100000000L.
1999-04-12 14:34:16 +00:00
Guido van Rossum 6a86f66ad7 Get rid of #! line 1999-04-09 14:49:04 +00:00
Guido van Rossum 9a744a9dd7 The usual 1999-04-08 20:27:54 +00:00
Guido van Rossum 0b7dd08d50 # Bah. The same problem occurred a second time. 1999-04-08 20:22:46 +00:00
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