Commit Graph

2311 Commits

Author SHA1 Message Date
Fred Drake 81ffe75d1c Message.__delitem__(): If the key doesn't exist in the dictionary,
raise KeyError instead of failing silently!
1999-09-10 20:54:53 +00:00
Guido van Rossum 75ae7e7dfa Fix for PR#74 -- use int() instead of eval() to extract the exponent. 1999-09-10 14:34:48 +00:00
Barry Warsaw 148ffbc886 canonic(): This used to be equivalent to str() but that caused too
much breakage (esp. in JPython which holds absolute path names in
co_filename already).  This implementation uses os.path.abspath() as a
slightly better way to canonicalize path names.  It implements a
cache.
1999-09-09 23:24:33 +00:00
Barry Warsaw 2bee8feac6 Pdb.lineinfo(): Don't use os.popen('egrep ...') to find the line in
the file that a function is defined on.  Non-portable to Windows and
JPython.  Instead, new find_function() uses re module on a similar
(simple-minded) pattern.
1999-09-09 16:32:41 +00:00
Guido van Rossum a41c691371 Make the maxsize constructor argument default to 0 (an unlimited queue size). 1999-09-09 14:54:28 +00:00
Greg Ward 71eb8644d7 Changed to reflect the new "command options" regime -- in particular,
we no longer explicitly pull distribution options out of our Distribution
object, but rather let the Distribution put them into the command object.
1999-09-08 02:42:30 +00:00
Greg Ward 42926ddc7e Careful rethink of command options, distribution options, distribution
attributes, etc.  Biggest change was to the Distribution constructor
  -- it now looks for an 'options' attribute, which contains values
  (options) that are explicitly farmed out to the commands.  Also,
  certain options supplied to Distribution (ie. in the 'setup()' call in
  setup.py) are now "command option aliases", meaning they are dropped
  right into a certain command rather than being distribution options.
  This is handled by a new Distribution class attribute,
  'alias_options'.
Various comment changes to reflect the new way-of-thinking.
Added 'get_command_name()' method to Command -- was assuming its
  existence all along as 'command_name()', so changed the code that
  needs it to call 'get_command_name()'.
1999-09-08 02:41:09 +00:00
Greg Ward 3d50b908ba Ditched redundant docstrings and comments (overlap with ccompiler.py).
Ditched redundant '_gen_preprocess_options()' and '_gen_lib_options()'
  -- now provided by ccompiler.py.
Fixed some filename extension variables -- added missing period.
Cosmetic tweaks.
1999-09-08 02:36:01 +00:00
Greg Ward c294113f18 Ditched '_gen_preprocess_options()' and '_gen_lib_options()' -- they're
now provided (minus the leading underscore) by the ccompiler module.
Fix 'compile()' to return the list of object files generated.
Cosmetic tweaks/delete cruft.
1999-09-08 02:32:19 +00:00
Greg Ward f7a39ecac1 os.name is "posix" or "nt" or we don't care.
Added big comment about the kludginess of passing 'build_options'
  to the link methods and how to fix it.
Added 'gen_preprocess_options()' and 'gen_lib_options()' convenience
  functions -- the two cases are very similar for Unix C Compilers and
  VC++, so I figured I might as well unify the implementations.
1999-09-08 02:29:08 +00:00
Greg Ward a4d132a868 [from 1999/08/28]
Apparently os.name is "nt" or "posix" or we don't care.
Cosmetic tweaks.
1999-09-08 02:23:28 +00:00
Andrew M. Kuchling 2d813e5140 Fixed 'return EOFError' that should be 'raise EOFError', caught by
Skip Montanaro's return-value patches.
1999-09-06 16:34:51 +00:00
Guido van Rossum a07934e53f Correct typo in AddressList.__getitem__. By Moshe Zadka. 1999-09-03 13:23:49 +00:00
Guido van Rossum 183fd40987 Fix indent error in __format(): del context[objid] at the end should
be executed in all cases, not just when it's not a list, tuple or
dict.  Discovered by Christian Tismer.
1999-09-02 15:09:44 +00:00
Greg Ward 65f4a3b173 Patch from Perry Stoll: caught up with changes in CCompiler necessary (?)
for MSVCCompiler.
1999-08-29 18:23:32 +00:00
Greg Ward 32162e832e Patch from Perry Stoll: tweaks to Windows support. 1999-08-29 18:22:13 +00:00
Greg Ward 69628b0ad1 Patch from Perry Stoll: support for Windows. 1999-08-29 18:20:56 +00:00
Greg Ward 1ea8af2fe0 Patch from Perry Stoll: import types module. 1999-08-29 18:20:32 +00:00
Greg Ward 440e2f51ea Patch from Perry Stoll: typo fix, make sure we only compile .py files. 1999-08-29 18:19:37 +00:00
Greg Ward 5d60fcf02a Patch from Perry Stoll: OK for list of modules to be empty. 1999-08-29 18:19:01 +00:00
Greg Ward 2f1b5bb905 Patch from Perry Stoll: pass 'build_info' to link method. 1999-08-29 18:18:26 +00:00
Greg Ward 26e48ea7df Patch from Perry Stoll:
- fix some broken abstract methods
  - kludge: add 'build_info' parameter to link methods
  - add 'object_name()' and 'shared_library_name()'
  - support for MSVCCompiler class on NT/Win95
1999-08-29 18:17:36 +00:00
Greg Ward dbd1276dcb Added msvccompiler module exactly as supplied by Perry Stoll. 1999-08-29 18:15:07 +00:00
Guido van Rossum b35d6846d9 Sjoerd Mullender writes:
"""
Added some optional arguments to the XMLParser __init__ method to
specify that selected non-standard constructs are to be accepted.
Also removed the documentation for handle_entityrefs since it isn't
used.
"""

The version is incremented to 0.3.
1999-08-26 15:52:33 +00:00
Guido van Rossum 3601e88cb3 Sjoerd Mullender writes:
"""
Extended chunk so that it can also handle formats that are almost
according to EA IFF 85.  In particular, added options to handle
little-endian and to handle formats that include the header size in
the chunk size value.

Fixed a bug where the header size was included in the chunk size, which
it isn't according to EA IFF 85.

Added a new method getsize() to get the size of the chunk (excluding
header).

Fixed chunk documentation (TIFF doesn't look like it uses chunks).
Converted wave to use chunk.  Wave uses EA IFF 85 chunks except that
it uses little-endian encoding of integer data.

Removed __del__ methods from aifc and wave since I got an
AttributeError there upon exit.
"""
1999-08-26 15:50:43 +00:00
Guido van Rossum e61e98d2ae Add calls to self.protocol("WM_DELETE_WINDOW", self.destroy) to the Tk
and Toplevel class constructors.  This means that if the window
manager closes the window, the Python-side Tkinter data structures
will be destroyed correctly.  (Most apps do this anyway, and it's
recommended practice; I see no reason why making it the default
behavior could be bad.)
1999-08-20 18:26:06 +00:00
Barry Warsaw 008edbf973 A nit to make Fred proud. 1999-08-19 21:17:08 +00:00
Greg Ward 1016af9fa6 Oops, call 'os.path.join()'! 1999-08-19 20:02:10 +00:00
Guido van Rossum f8e390b1b5 New version by Mark-Andre Lemburg (generated by a script, parseentities.py). 1999-08-19 15:59:35 +00:00
Guido van Rossum 1ebcf6aabb Patches by Michael Reilly to correctly deal with ftp URLs of the form
ftp://user@host//root/path: the double slash in the pathname means to
go to the root directory even if the initial directory isn't the root.
1999-08-18 21:51:10 +00:00
Guido van Rossum 959fa01dc3 Typo in comment (on Mac, it's the *resource* fork that's not copied,
the data fork *is* copied).
1999-08-18 20:03:17 +00:00
Guido van Rossum 5e006a3cc3 Patches by Michael Reilly to correctly deal with ftp URLs of the form
ftp://user@host//root/path: the double slash in the pathname means to
go to the root directory even if the initial directory isn't the root.
1999-08-18 17:40:33 +00:00
Guido van Rossum 6c395ba316 Add Tim Peters' shuffle() algorithm. 1999-08-18 13:53:28 +00:00
Greg Ward e393ddb2e0 Implements the 'build_ext' command for building C/C++ extension modules. 1999-08-14 23:57:49 +00:00
Greg Ward b4dbfb318c Module to spawn sub-commands in a platform-independent way.
Initial revision only includes support for POSIX-style fork-and-exec.
1999-08-14 23:57:17 +00:00
Greg Ward 5e71744000 Changed to use 'spawn()', now that it exists.
Added 'verbose' and 'dry_run' parameters to constructor.
Changed 'compile()', 'link_*()' to default lists arguments to None
  rather than empty list.
Added implementations of the filename-mangling methods mandated by
  the CCompiler interface.
1999-08-14 23:53:53 +00:00
Greg Ward e1aaaa653c Added 'verbose' and 'dry_run' flags to CCompiler constructor and
'new_compiler()' factory function.
Added 'runtime_library_dirs' list (for -R linker option) and methods
  to manipulate it.
Deleted some obsolete comments.
Added all the filename manglign methods: 'object_filenames()',
  'shared_object_filename()', 'library_filename()',
  'shared_library_filename()'.
Added 'spawn()' method (front end to the "real" spawn).
1999-08-14 23:50:50 +00:00
Greg Ward 7f65c65208 Comment tweak. 1999-08-14 23:47:21 +00:00
Greg Ward 0081cc529c Better detection of bad entries in option table.
Better error messages for bad entries in option table.
1999-08-14 23:44:37 +00:00
Greg Ward 8c66b697c1 Added DistutilsExecError, DistutilsValueError. 1999-08-14 23:43:45 +00:00
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
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