Commit Graph

1737 Commits

Author SHA1 Message Date
Guido van Rossum 01fc65d92f From: conrad@cgl.ucsf.edu (Conrad Huang %CGL)
To: python-list@cwi.nl
Date: 13 May 98 18:33:11 GMT

I think I found a bug in CGIHTTPServer.py.  (Does anyone care? :-)
I was trying to use it as the web server for uploading files.
Python CGI scripts (using the CGI module) that worked for other
servers (e.g., Netscape Enterprise server) hang when run from
CGIHTTPServer.  The problem is that the content type parameters,
in particular the boundary parameter, were not passed through to
the CGI scripts, thus making the MIME parsing code choke.

My simple-minded fix is:

	% diff CGIHTTPServer.py /usr/local/lib/python1.5/CGIHTTPServer.py
	137,140c136
	<           if self.headers.typeheader is None:
	<               env['CONTENT_TYPE'] = self.headers.type
	<           else:
	<               env['CONTENT_TYPE'] = self.headers.typeheader
	---
	>           env['CONTENT_TYPE'] = self.headers.type

Conrad
1998-05-13 20:13:24 +00:00
Guido van Rossum b298a300dd Reduce memory requirements. 1998-05-12 13:21:31 +00:00
Guido van Rossum 03e35c548f Add a few doc strings. 1998-05-10 18:27:29 +00:00
Guido van Rossum ea176b663e benchmark for list.sort() 1998-05-10 18:20:05 +00:00
Guido van Rossum b1b4f94527 Make Tim O'Malley's requested change: in FieldStorage.__init__(), when
method='GET', always get the query string from environ['QUERY_STRING']
or sys.argv[1] -- ignore an explicitly passed in fp.
1998-05-08 19:55:51 +00:00
Fred Drake 073b829021 When a file name is selected ("OK" button, <Return> in the filename entry),
and the "key" keyword parameter was used to invoke .go(), use the directory
of the selected file as the stored directory to return to when the same key
is used again.  This is useful since the user may well entry at least part
of the path in the filename box instead of doing a lot of clicking around in
the listboxes.
1998-05-06 17:28:23 +00:00
Guido van Rossum e7b6e396fc New files from Thomas Gellekum 1998-05-06 15:14:36 +00:00
Guido van Rossum d618c91f14 Added table of WSA error codes. 1998-05-06 13:48:04 +00:00
Guido van Rossum e0c0da98d8 Patches to make the proxy code work again. (Why does that always break
as soon as I change things even just a little bit? :-)  Even works
when accessing a password-protected page through the proxy.  Prompted
by complaints from, and correct operation verified by, Nigel O'Brian.
1998-05-05 13:58:13 +00:00
Guido van Rossum a986bb7e5c Take out the check for AUTH-LOGIN or AUTH=LOGIN in login() -- some
servers support LOGIN but don't advertise it.  If it's not supported
the protocol will respond NO.  Approved by Piers Lauder.
1998-05-05 03:08:46 +00:00
Guido van Rossum b485224d82 REMOVE samefile(), sameopenfile(), samestat() -- these cannot be made
to work reliably (at least I wouldn't know how).
1998-05-02 00:47:09 +00:00
Guido van Rossum e365a590d4 Change the names of all methods in the Wm class: they are now
wm_title(), etc.  The old names (title() etc.) are still defined as
aliases.

This brings all methods up to use the same naming convention: whether
the Tcl syntax is

   .window.path.name command subcommand [options]

or

   command subcommand .window.path.name [optins]

the Python equivalent is always

   windowobject.command_subcommand(options)
1998-05-01 19:48:20 +00:00
Guido van Rossum 0132f69c2e Another optimization, probably of negligeable effect: instead of
calling self.tk.getint() and self.tk.getdouble(), call the globals
getint() and getdouble(), which in turn are just names for the Python
builtins int() and double().  (Making them globals actually save a
dict lookup compared to using the built-in.)  The corresponding
methods of class Misc have been changed similarly.  (Note that
getboolean() hasn't been changed because there's no Python
equivalent.)

The use of int() and float() has another advantage: if/when Tcl calls
can actually return Tcl objects with other types than string, use of
int() and float() is essential.
1998-04-30 17:50:36 +00:00
Guido van Rossum dc59340646 In _bind(), found a way to test for break without a temp variable. 1998-04-29 22:16:57 +00:00
Guido van Rossum f975699c07 Save a tiny bit of time: self.tk.call takes a tuple argument so it's
not needed to say apply(self.tk.call, t); self.tk.call(t) has the same
effect.  This cuts down tremendously on the number of apply() calls
made.  No measurable effect, but at the very least it saves the lookup
of apply() in the globals!
1998-04-29 21:57:08 +00:00
Guido van Rossum f0c891a2b2 Import MacOS at the top instead of insize Tk.__init__() -- the latter
repeats the I/O for the failed import on each interpreter creation.
1998-04-29 21:43:36 +00:00
Guido van Rossum 7e6d18c1c0 Replace all calls to acquire_lock() and release_lock() with acquire()
and release() instead.
1998-04-29 14:29:32 +00:00
Guido van Rossum 57a0661cb8 On the Mac, create the Temporary Items folder if it does not exist yet.
(Jack)
1998-04-28 16:03:34 +00:00
Guido van Rossum 9c93a69335 Put quotes around the filename, so spaces in filenames work.
(Jack)
1998-04-28 16:03:03 +00:00
Guido van Rossum 53117ae82a typo in error message (fname vs. file).
(Jack)
1998-04-28 16:01:13 +00:00
Guido van Rossum b86ba124ea Support byte-swapped dbhash (bsddb) files. Found by Ben Sayer. 1998-04-28 15:41:03 +00:00
Guido van Rossum fc1f64d90d Oops, I had 'n' and 'c' mixed up in my mind. Get rid of the comment
that wonders what the difference is and explain them properly.
1998-04-28 15:23:09 +00:00
Guido van Rossum a5c0998242 Inspired by Ben Sayer, rewritten the code and some of the comments to
be more intelligent when the database already exists (use the module
for the existing file, according to whichdb).  Noted in the doc
strings that there doesn't seem to be a different between 'c' and 'n'.
1998-04-28 15:19:34 +00:00
Guido van Rossum e86271af72 When setting the event structure fields, don't die when the widget
name is not registered; simply use the string.  This happens for
tear-off widgets (e.g. if you've registered enter/leave events for the
menu).
1998-04-27 19:32:59 +00:00
Guido van Rossum 0eae8fba81 Feeble attempt at making urlopen more robust -- don't call splituser()
when splithost() returned no useable host, to avoid calling
splituser() on None.
1998-04-27 15:19:17 +00:00
Fred Drake 9291d271fb parse150(): Simplify RE used to parse the message a little, taking advantage
of using re instead of regex.
1998-04-27 14:39:44 +00:00
Guido van Rossum 446898ff4a Use hex() when outputting the various checksums so the test output is the
same on 32 and 64 bit machines.
1998-04-24 18:31:28 +00:00
Guido van Rossum bb189dbcb0 Small corrections to comments that were cloned from aifc; moreover
the description of setparams() was wrong.

wave.py: Include the tag of an unknown format in the exception.
1998-04-23 21:40:02 +00:00
Guido van Rossum 1740b8d2f7 New test sample -- "Nobody expects the Spanish Inquisition!" 1998-04-23 21:37:22 +00:00
Guido van Rossum e26132cf5e Move unified findfile() into test_support.py 1998-04-23 20:13:30 +00:00
Guido van Rossum 5fd90684a9 Run the self-test (test.test_MimeWriter) when invoked as a script. 1998-04-23 13:34:57 +00:00
Guido van Rossum 2ad816f47e Add test for MimeWriter module 1998-04-23 13:33:56 +00:00
Guido van Rossum e87ed5f6d4 Add writelines() method to Compare class. 1998-04-23 13:33:21 +00:00
Guido van Rossum 9a34523e19 As Tim Peters points out, ``from string import *'' should not set re to None.
Also rename safe_env to _safe_env.
1998-04-20 14:01:00 +00:00
Fred Drake de2f708299 Fix regexp for attrfind; bug reported by Lars Marius Garshol
<larsga@ifi.uio.no>.
1998-04-16 21:04:26 +00:00
Fred Drake ac36c6403f Open wave files in binary mode.
Accept 'rb' and 'wb' as well as 'r' and 'w' as the mode parameter to open().
1998-04-16 16:44:33 +00:00
Guido van Rossum 64d036c8fe Add connect_ex to list of methods. 1998-04-14 01:30:45 +00:00
Guido van Rossum fb9b7fd5ee Be nicer to systems that have neither termios nor msvcrt. 1998-04-13 20:22:21 +00:00
Guido van Rossum b19e2a383c Whoops! Add a missing 'instantiated = 1' to load_inst(); otherwise it
would still try to call the class...
1998-04-13 18:08:45 +00:00
Guido van Rossum be14e69742 New revision -- sometimes it's AUTH-LOGIN, sometimes AUTH=LOGIN! 1998-04-11 03:11:51 +00:00
Guido van Rossum 5c7e8cd267 Avoid using the obsolete rand module; and improve the randomness
of the boundary chosen by choose_boudary() by using milliseconds
of the timestamp.
1998-04-11 03:06:02 +00:00
Guido van Rossum 38d8f4e1c2 New version doesn't require REV1 capability. 1998-04-11 01:22:34 +00:00
Guido van Rossum c74521acc4 Oops -- remove some debug print statements! 1998-04-11 01:18:35 +00:00
Guido van Rossum c296651e10 Add image_types() and image_names() as methods to Misc class. 1998-04-10 19:16:10 +00:00
Guido van Rossum ce73acf5e6 Tim's version 4, with my mods 1998-04-10 19:14:59 +00:00
Guido van Rossum 4cee3c49c2 Another easter present. 1998-04-10 16:14:34 +00:00
Guido van Rossum 7f5013a9a9 New Java-style threading module. The doc strings are in a separate module. 1998-04-09 22:01:42 +00:00
Guido van Rossum bb08066053 The usual 1998-04-09 21:47:39 +00:00
Guido van Rossum b5903ac9fb Another new utility: getpass() prompts for a password, with echo off.
Also contains getuser(), which returns the username (not prompting though).
These work on Unix and Windows!
1998-04-09 20:37:16 +00:00
Guido van Rossum 29e5f5d81f When getcwd() doesn't exist or raises an exception, don't fail but
fall back to using os.curdir instead; if it is fine, don't use
os.curdir at all.
1998-04-09 14:27:57 +00:00
Guido van Rossum c09e6b1c0a Clarify that put *blocks* when the queue is full. Add some blank
lines to doc strings.
1998-04-09 14:25:32 +00:00
Guido van Rossum eeec0af307 Piers' new version (but I unfolded a few doc strings). 1998-04-09 14:20:31 +00:00
Guido van Rossum c2c07fa10c Piers Lauder's IMAP module. 1998-04-09 13:51:46 +00:00
Guido van Rossum 03774bb5ea Version with docstrings and some other changes, by Piers Lauder.
(Adapted by Just, I believe.)
1998-04-09 13:50:55 +00:00
Fred Drake 3217be9395 Relocating file to Lib/lib-old. 1998-04-09 04:05:43 +00:00
Fred Drake 153165ca3d Restore ni as an obsolete module. 1998-04-09 04:04:18 +00:00
Guido van Rossum 484772d472 Dave Ascher's pop client code. 1998-04-06 18:27:27 +00:00
Guido van Rossum 8053d89f7b Add usage message when no arguments. 1998-04-06 14:45:26 +00:00
Guido van Rossum f4b44fa6ef Tim's latest version (supports old and new tokenize modules) 1998-04-06 14:41:20 +00:00
Guido van Rossum 986abac1ba Give in to tabnanny 1998-04-06 14:29:28 +00:00
Guido van Rossum 1ae297ae8b Remove some long obsolete files... 1998-04-06 14:16:12 +00:00
Guido van Rossum f62cf61548 Give in to tabnanny. 1998-04-06 14:14:25 +00:00
Guido van Rossum 5810297052 Correction to vonmisesvariate() by Magnus Kessler: it should take and
return something between 0 and 2*pi.  Also added a reference to the
literature.
1998-04-06 14:12:13 +00:00
Guido van Rossum 56c04b8376 Restructured the event_* calls slightly -- there's really no need to
use the default root, and instead of string.split, use splitlist.
1998-04-06 03:10:03 +00:00
Fred Drake bdc61b1c7b Relocating file to Lib/lib-old. 1998-04-04 01:05:17 +00:00
Fred Drake a351f89a94 Relocating file to Lib/lib-old. 1998-04-04 00:54:56 +00:00
Guido van Rossum 8430c583da AMK's latest 1998-04-03 21:47:12 +00:00
Guido van Rossum a50547e0c0 Track changes in tokenize.py 1998-04-03 19:56:40 +00:00
Guido van Rossum 18586f4c48 Add optional argument to help(). 1998-04-03 17:03:13 +00:00
Guido van Rossum 1d5102cac1 Explicitly close rfile and wfile in StreamRequestHandler.finish() --
mostly for jpython.
1998-04-03 16:49:52 +00:00
Guido van Rossum a90c78b918 Differentiate between NEWLINE token (an official newline) and NL token
(a newline that the grammar ignores).
1998-04-03 16:05:38 +00:00
Guido van Rossum fbe63de37d UnixMailbox: don't be fooled by lines that begin with "From " but
otherwise don't look like headers at all...
Also robustify the test code a bit.
1998-04-03 16:04:05 +00:00
Guido van Rossum 7e07b3845b Sjoerd's latest. 1998-04-03 16:02:39 +00:00
Guido van Rossum 0454b51282 Oops, pulled over by the tab police :-) 1998-04-03 15:57:58 +00:00
Guido van Rossum b5916ab065 Change by Sjoerd (with minor reformatting):
guess the mime type of a local file.

Change suggested by Sjoerd (with different implementation):
  when retrieve() creates a temporary file, preserve the suffix.

Corrollary of the first change:
  also return the mime type of a local file in retrieve().
1998-04-03 15:56:16 +00:00
Guido van Rossum 75d92c1864 Added a __delitem__ to the Message class.
(Still no __setitem__, until I get a request to add it!)
1998-04-02 21:33:20 +00:00
Guido van Rossum b1062fc9d2 Correct dumb typo found by kjpylint (stack should be self.stack). 1998-03-31 17:00:46 +00:00
Guido van Rossum 599174f74d Correct a definite typo ('mem' should be 'memo'). 1998-03-31 16:30:28 +00:00
Guido van Rossum 9ab75cbaab Tim Peters' program for checking whether a program's indentation is
sensitive to tab size.  Uses a different strategy than tabpolice.py,
but has compatible usage.
1998-03-31 14:31:39 +00:00
Guido van Rossum a6bb6be95f Strip argument to atol and atof to match what strop does better. 1998-03-30 17:22:30 +00:00
Guido van Rossum a08fabad72 A few lines were indented using spaces instead of tabs -- fix them. 1998-03-30 17:17:24 +00:00
Guido van Rossum 117a5a8138 Return the name of the Tcl command defined by _bind(). This can
optionally be passed to unbind() (or you can apss it to
deletecommand()).
1998-03-27 21:26:51 +00:00
Guido van Rossum 548703a1b8 The usual. 1998-03-26 22:14:20 +00:00
Guido van Rossum 65e5399081 Don't write "if self.dict: self.dict.close()"; just write
"self.dict.close()" and ignore the exception.  The "if self.dict:"
part would be calculated through len(self.dict.keys()), which is very
expensive for a large dictionary...
1998-03-26 22:12:22 +00:00
Guido van Rossum 3ec38f0ee4 A few lines were indented using tabs instead of spaces -- fix them. 1998-03-26 22:10:50 +00:00
Guido van Rossum 45e2fbc2e7 Mass check-in after untabifying all files that need it. 1998-03-26 21:13:24 +00:00
Guido van Rossum 9ea7024754 Delete this unused relic. 1998-03-26 21:07:14 +00:00
Guido van Rossum 7e7ca0ba17 A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 21:01:39 +00:00
Guido van Rossum 8ca842066c A few lines were indented using spaces instead of tabs -- fix them. 1998-03-26 20:56:10 +00:00
Guido van Rossum fa6e254b34 Mass check-in after untabifying all files that need it. 1998-03-26 20:23:01 +00:00
Guido van Rossum 1847d06493 Reindented with tabs only (seems fair to the Windows crowd). 1998-03-26 20:22:30 +00:00
Guido van Rossum 2830dcc15c Get rid of the Emacs cruft now that Python-mode guess the desired settings! 1998-03-26 19:52:46 +00:00
Guido van Rossum 41360a4696 Mass check-in after untabifying all files that need it. 1998-03-26 19:42:58 +00:00
Guido van Rossum cd0f59ea08 Get rid of the Emacs cruft now that Python-mode guess the desired settings! 1998-03-26 19:30:30 +00:00
Guido van Rossum 69c70a2fd1 Support 'whence' parameter to seek(). 1998-03-25 16:25:26 +00:00
Guido van Rossum c8d36284f3 Give in to Timmy's Tedious Tab Theorem. 1998-03-23 15:31:22 +00:00
Guido van Rossum c457048744 Give in to the tab police. 1998-03-20 20:45:49 +00:00
Guido van Rossum 677bedab0c Fix indent of one line in mkarg(), that got indented badly by the
recent reindent!
1998-03-19 15:14:24 +00:00
Guido van Rossum 3f0666c4a2 Add obvious needed else clause to format_exception(). 1998-03-18 17:48:06 +00:00
Guido van Rossum 96c07fefa9 Prefer clock() over times() for timer function, except on the Mac,
where we use GetTicks() -- its clock() is a crock, with only 1 second
accuracy, I believe.
1998-03-17 14:46:43 +00:00
Guido van Rossum 677fc843ea As Mike Fletcher pointed out, a __deepcopy__() method should be called
with the memo as an argument.
1998-03-13 20:12:17 +00:00
Guido van Rossum 6d4d1c2a25 Added support for "data" URL, by Sjoerd Mullender. 1998-03-12 14:32:55 +00:00
Guido van Rossum 5c1d2297ea Instead of 'import mac', use 'import os' -- this way, the path syntax
manipulation routines can be used on non-Mac platforms (e.g. to
manipulate pathnames in a Mac specific archive).
1998-03-03 21:49:01 +00:00
Guido van Rossum 9e43adbe78 Initialize adlist variable in getrouteaddr(), so an illegal address
doesn't cause a traceback.
1998-03-03 16:17:52 +00:00
Guido van Rossum d8c5b8c90f Typo (coestring -> codestring) discovered by Mark Hammond. 1998-03-02 02:40:39 +00:00
Guido van Rossum 13452644d5 Sjoerd writes: When a multipart message is incomplete, mimify crashes. 1998-02-27 14:40:38 +00:00
Guido van Rossum 6e73af723c New version of tb_lineno(), this time *not* using try-except, to avoid
disturbing the current exception, and returning tb.tb_lineno, which is
the line number of thr traceback, rather than the current line number.
By Jim Hugunin.
1998-02-26 17:25:02 +00:00
Guido van Rossum 46c86bbca9 A working version of the 'args' command (it prints the current values
of the variables known to hold arguments, but that's as close as I can
get, and generally it's close enough).
1998-02-25 20:50:32 +00:00
Guido van Rossum d151d34ebd Add test for core dump -- make sure it doesn't come back! 1998-02-25 17:51:50 +00:00
Guido van Rossum 7266496b00 Tweak the tb_lineno() function to be compatible with JPython, which
has no line number table etc.
1998-02-25 16:33:39 +00:00
Guido van Rossum 21df8f5dc4 Typo: baseWidht -> baseWidth. 1998-02-24 23:26:18 +00:00
Guido van Rossum 0001a11986 Fix bug in trace_vdelete(); should use master's delete command. 1998-02-19 21:20:30 +00:00
Guido van Rossum 2fc4d581ba Added debug statements to report data actually sent and received on
the socket.
1998-02-19 21:19:48 +00:00
Guido van Rossum b1908846af Fix for literal null bytes -- these must be replaced by the four
characters \, 0, 0, 0.
1998-02-19 21:18:56 +00:00
Guido van Rossum 72c2e1b56e Fixed a bug in the gauss() function. The bug was reported by Mike
Miller, who complained that its kurtosis was bad, and then fixed by
Lambert Meertens (author of the original algorithm) who discovered
that the mathematical analysis leading to his solution was wrong, and
provided a corrected version.  Mike then tested the fix and reported
that the kurtosis was now good.
1998-02-19 21:17:42 +00:00
Guido van Rossum 9824509d3e Add rmd() (remove directory command); fix comment in parse257.
In login(), force passwd and acct to '' when they are None (this can
happen in the test program!).
1998-02-19 21:15:44 +00:00
Guido van Rossum 0d530cedd7 Faster implementation of normcase (using string.lower(
string.replace(...)) instead of a for loop).

Don't call normcase() in normpath() -- the filesystem just might be
case preserving...
1998-02-19 21:08:36 +00:00
Guido van Rossum a73033fcc2 Feature added by Bill van Melle: when no timezone is present, assume
local time -- that's better than failure.
1998-02-19 00:28:58 +00:00
Guido van Rossum 16a0bc278e (1) Change normpath() to *not* also call normcase().
(2) Fix normcase() to use string.lower() and string.replace() -- it
turns out that the table constructed for translate() didn't work in
locales that have a different number of lowercase and uppercase
letters.
1998-02-18 13:48:31 +00:00
Guido van Rossum 00455b77a6 Fix sign reversal in mktime_tz discovered by Bill van Melle. 1998-02-18 05:06:30 +00:00
Guido van Rossum 358473c1a2 Andrew Kuchling writes:
First, the RNG in whrandom.py sucks if you let it seed itself from the time.
The problem is the line:
			t = int((t&0xffffff) | (t>>24))
Since it ORs the two parts together, the resulting value has mostly
ON bits.  Change | to ^, and you don't lose any randomness.
1998-02-16 14:52:42 +00:00
Guido van Rossum e60142f2c1 Adding output of test_xmllib.py 1998-02-13 16:35:21 +00:00
Fred Drake fe82acc3b1 Fixed typo in docstring: "__ version__" --> "__version__" 1998-02-13 03:24:48 +00:00
Guido van Rossum 8a666e7c56 Fix a horrible race condition -- various routines were storing the
most recently opened URL in self.openedurl of the URLopener instance.
This doesn't really work if multiple threads share the same opener
instance!

Fix: openedurl was actually simply the type prefix (e.g. "http:")
followed by the rest of the URL; since the rest of the URL is
available and the type is effectively determined by where you are in
the code, I can reconstruct the full URL easily, e.g. "http:" + url.
1998-02-13 01:39:16 +00:00
Guido van Rossum d76732918a Added rmtree(), to recursively remove a directory tree.
Code by David Ascher (docstring by me).
1998-02-06 21:38:09 +00:00
Guido van Rossum 03710d2a40 Two suggested features by Sjoerd:
- use the tempcache in the open() method, too.

- use the "unwrap"ped url as key for the tempcache.
1998-02-05 16:22:27 +00:00
Guido van Rossum c5d8fed261 (1) Use matchobj.groups(), not matchbj.group() to get all groups.
(2) Provisional hack to avoid dying when trying to turn echo on or off
on Macs, where os.system() doesn't exist.
1998-02-05 16:21:28 +00:00
Guido van Rossum c9aef03af4 Make this test work when imported from the interpreter instead of run
from regrtest.py (it still works there too, of course).
1998-01-29 21:53:17 +00:00
Guido van Rossum fc40a8316a Sez The Dragon:
Ok, I fixed the quotes, along with a bug or two.
	Also added another exception.
1998-01-29 17:26:45 +00:00
Guido van Rossum bbe323e52c SMTP client by The Dragon De Monsyne <dragondm@integral.org>. 1998-01-29 17:24:40 +00:00
Guido van Rossum 02505e4850 New version of xmllib from Sjoerd.
The main incompatibility is that the error reporting method is now
called as
 parser.syntax_error(msg)
instead of
 parser.syntax_error(lineno, msg)

This new version also has some code to deal with the <?xml?> and
<!DOCTYPE> tags at the start of an XML document.
The documentation has been updated, and a small test module has been
created.
1998-01-29 14:55:24 +00:00
Guido van Rossum b16a3b8450 (This fix is really by Jeremy)
Here's my suggested replacement for gzip.py for 1.5.1.  I've
re-implemeted methods readline and readlines, added an _unread, and
tweaked read and _read.

I tried a more complicated buffer scheme for unread (using a list of
strings and string.join), but it was more complicated and slower.
This version is a lot faster than the current version and is still
pretty simple.
1998-01-27 19:29:45 +00:00
Barry Warsaw abe2a457de Unpickler.load_inst(), Unpickler.load_obj(), Unpickler.load_build():
Fixed problems when unpickling in restricted execution environments.
These methods try to assign to an instance's __class__ attribute, or
access the instances __dict__, which are prohibited in REE.  For the
first two methods, I re-implemented the old behavior when assignment
to value.__class__ fails.

For the load_build() I also re-implemented the old behavior when
inst.__dict__.update() fails but this means that unpickling in REE is
semantically different than unpickling in unrestricted mode.
1998-01-26 22:47:35 +00:00
Barry Warsaw 5da0f504ba get(): Fixed a bug in the merge order of the dictionaries. This makes
a copy of the defaults dictionary and merges the section's dictionary
into it so that sections can override the defaults.
1998-01-26 22:42:48 +00:00
Guido van Rossum c567b8176a Revamped, to match py_compile.py:
- added docstrings
- support option to specify a different purported directory name
- reindented with 4 spaces
1998-01-19 23:07:55 +00:00
Guido van Rossum f7edadbc58 Add Gopher to list of protocols that support query strings. 1998-01-19 22:27:21 +00:00
Guido van Rossum e7579624ef Fix bad new bug in ftp code -- the test for existing file using NLST
would set the transfer to text mode instead of the specified mode.
1998-01-19 22:26:54 +00:00
Guido van Rossum ca99c2ce75 Fix to ismount(). Can't remember who told me this. 1998-01-19 22:25:59 +00:00
Guido van Rossum 29c4688659 Patch by Tim O'Malley for servers that send a response looking just like
HTTP/1.x 200
instead of
    HTTP/1.x 200 OK
1998-01-19 22:25:24 +00:00
Guido van Rossum d2dd9a8b7f Some patches by Lars Marius Garshol:
- fix type_to_name(); it never worked
- add path_to_selector()
add path_to_datatype_name()
1998-01-19 21:59:48 +00:00
Guido van Rossum 63566e2ef2 Added docstrings.
Added an optional third parameter giving the purported filename for
error messages from the module.

Append a newline to the code string if needed.
1998-01-19 04:01:26 +00:00
Guido van Rossum e2c6e203c6 Add trace methods to class Variable 1998-01-14 16:44:34 +00:00
Guido van Rossum f473cb007b Added tests for qualified sub and split 1998-01-14 16:42:17 +00:00
Guido van Rossum 8687164426 Seems I've found a way to fix this. 1998-01-14 15:40:30 +00:00
Guido van Rossum 0d8fcb233e Update the doc string to emphasize non-Unix behavior earlier;
sys.prefix is no longer empty on any platform that I know of.
1998-01-13 18:32:40 +00:00
Guido van Rossum 2b2b3f9bcb Fix two bugs:
(1) maxsplit was ignored in split().

(2) groups() would return a string instead of a singleton tuple when
there was only one group.
1998-01-12 18:57:53 +00:00
Guido van Rossum 46f37144d3 New module added. 1997-12-31 00:11:03 +00:00
Guido van Rossum 51ca6e3e42 When there's no filename, don't make one up.
Added _test() that behaves (a bit) like gzip.
Fix a comment (*sequential* access is okay -- *random* access it out!)
1997-12-30 20:09:08 +00:00
Guido van Rossum f5910e42d1 Add tests for re.L(OCALE). 1997-12-30 17:32:33 +00:00
Guido van Rossum 380bf64424 Since DSA.py never made it to the release, neither should dos-8x3/dsa.py. 1997-12-30 05:03:39 +00:00
Guido van Rossum d01e9aa0df the usual 1997-12-30 04:20:58 +00:00
Guido van Rossum 1cd6a457d9 Two critical fixes to the changes that I made for Greg McFarlane --
patches provided by Greg (am I glad I sent him my latest version!).
1997-12-30 04:07:19 +00:00
Guido van Rossum 5baf4bc978 Moved things around a bit in interact(), so outout is processed before
input.  When an EOF is read, break out of the loop instead of (by
default) writing an empty line (which doesn't do much good).  Don't
close self when falling through the loop.
1997-12-29 20:05:45 +00:00
Guido van Rossum 9fd41e363b Fixed several bugs reported by Greg McFarmane:
*  The invoke methods of the three Tkinter widgets Button,
    Checkbutton and Radiobutton should return the value returned by
    the callback, (like the Menu widget does):

	def invoke(self):
	    return self.tk.call(self._w, 'invoke')

 *  The select_from method of the Canvas widget should use 'from', not
    'set':

	def select_from(self, tagOrId, index):
	    self.tk.call(self._w, 'select', 'from', tagOrId, index)

    Currently, if you use select_from, you get the error message:
 'TclError: bad select option "set": must be adjust, clear, from, item, or to'

 *  The 'entrycget' and 'type' methods of the Tk menu widget are
    missing from Tkinter.

 *  There is a bug in grid_columnconfigure and grid_rowconfigure.  For
    example, this should return the current value of the 'minsize'
    option for column 0:

	f.grid_columnconfigure(0, 'minsize')

    Instead it returns the same as:

	f.grid_columnconfigure(0)

    I suggest that the hint given in the comment in the
    Tkinter.Misc.configure method should be followed - "ought to
    generalize this so tag_config etc.  can use it".  Repeating the
    same configure code several times in Tkinter is inviting errors.
    [I did not follow this advice --G]

 *  The grid_slaves method should handle options.  Currently, to pass
    options to the grid_slaves method, you have to do something like:

	grid_slaves('-row', 1)
1997-12-29 19:59:33 +00:00
Guido van Rossum 23e21e7cf3 Minor editing corrections. 1997-12-29 19:57:36 +00:00
Guido van Rossum 2003204ba7 Added doc string, provided by Charles Waldman (with some reformatting
and a little editing my me).
1997-12-29 19:26:28 +00:00
Guido van Rossum d499004860 Solve two annoying problems with ftp URLs for Jack: when repeated
retrieving files from the same host and directory, you had to close
the previous instance before opening a new one; and retrieving a
non-existent file would return an empty file.  (The latter fix relies
on maybe an undocumented property of NLST -- NLST of a file returns
just that file, while NLST of a non-existent file returns nothing.  A
side effect, unfortunately, seems to be that now ftp-retrieving an
*empty* directory may fail.  Ah well.)
1997-12-28 04:21:20 +00:00
Guido van Rossum adfacf4e2e Do a better job of keeping the dialog visible when the master window
is near or beyond the edge of the screen.  Patch by Skip Montanaro.
1997-12-28 03:42:50 +00:00
Guido van Rossum 4d9d3f18c2 Typo: Widht instead of Width... 1997-12-27 15:14:43 +00:00
Guido van Rossum ccb5ec62e1 Added expect() method which takes a list of regular expressions and an
optional timeout.  Also moved some imports around.
1997-12-24 22:24:19 +00:00
Guido van Rossum 00f9fea288 Use string.replace instead of regsub.[g]sub. 1997-12-24 21:18:41 +00:00
Guido van Rossum b9b50eb7e0 Decided to add the telnet library that I wrote long ago (it's still in
the Demos/cwilib directory).  Converted comments to doc strings and
used default arguments instead of *args.  Updated the example.
1997-12-24 21:07:04 +00:00
Guido van Rossum b8c42c9825 Add new optional parameter 'suffix' (default ''), which is appended to
the temporary file name.  Also some minor formatting of Jim F's code.
1997-12-19 04:29:50 +00:00
Guido van Rossum 629bcfb8f9 Make this test succeed even when using "import test.test_zlib". 1997-12-18 05:21:07 +00:00
Guido van Rossum fedc6d0d5a Added SOLID definition. 1997-12-16 17:54:18 +00:00
Fred Drake b5323999d2 PhotoImage.put(): Fixed -to handling, including backward compatibility hack.
Guido, please take a look at this.
1997-12-16 15:03:43 +00:00
Guido van Rossum 80fb344a18 On NT, use a better template, ~XXX- where XXX is os.getpid(). 1997-12-15 19:11:53 +00:00
Guido van Rossum 92d91f56a7 Move %x test to nonstandard section because it appears to be locale specific. 1997-12-15 18:06:19 +00:00
Guido van Rossum f0413d4841 Added tag_prevrange analogous to rag_nextrange. 1997-12-15 17:31:52 +00:00
Guido van Rossum 30da0ea124 Believe it or not, some people have an empty group database.
Prevent the test from failing there.
1997-12-15 14:57:19 +00:00
Guido van Rossum 98b9d77666 Change _nametowidget to nametowidget -- it is a public interface. 1997-12-12 00:09:34 +00:00
Guido van Rossum 9e326665cf Remove unneeded "import re". 1997-12-11 21:41:13 +00:00
Guido van Rossum 7814ea64ff Last minute fix to Text.window_cget(), which should properly Tcl-ify
the option name (prepend '-', strip trailing '_').
1997-12-11 17:08:52 +00:00
Guido van Rossum 4d35e6f092 yeah, yeah. 1997-12-11 02:36:42 +00:00
Guido van Rossum 5ac00ac140 Fix problem detected by Greg McFarlane -- callbacks passed to
bind_class() and bind_all() are destroyed when the widget to which
they were passed is destroyed.
1997-12-11 02:03:55 +00:00
Guido van Rossum d1f4984a9b Jim Fulton writes:
The attached patch adds the following behavior to the handling
of REDUCE codes:

- A user-defined type may have a __reduce__ method that returns
  a string rather than a tuple, in which case the object is
  saved as a global object with a name given by the string returned
  by reduce.

  This was a feature added to cPickle a long time ago.


- User-defined types can now support unpickling without
  executing a constructor.

  The second value returned from '__reduce__' can now be None,
  rather than an argument tuple.  On unpickling, if the
  second value returned from '__reduce__' during pickling was
  None, then rather than calling the first value returned from
  '__reduce__', directly, the '__basicnew__' method of the
  first value returned from '__reduce__' is called without
  arguments.

I also got rid of a few of Chris' extra ()s, which he used
to make python ifs look like C ifs.
1997-12-10 23:40:18 +00:00
Guido van Rossum d0753e20b2 At Barry's suggestion, plug the security leak by using an empty
__builtins__ for all calls to eval().  This still allows someone to
write string.atof("[1]*1000000") (which Jim Fulton worries about) but
effectively disables access to system modules and functions.
1997-12-10 22:59:55 +00:00
Guido van Rossum 90d62ab0a1 Since this module is used as a fallback in case no built-in modules
have been configured, string.atof() should not fail when "import re"
fails (usually because pcre is not there).

This opens up a tiny security hole: *if* an attacker can make "import
re" fail, they can also make string.atof(arbitrary_string) evaluate
the arbitrary string.  Nothing to keep me awake at night...
1997-12-10 22:35:02 +00:00
Guido van Rossum e680546894 Don't specify base 0 to string.atoi when unpickling integers in text
mode.  The pickler always uses base 10 so the default base should be
fine.  (The base gets us in trouble when there's no strop module, as
the atoi() in string.py only supports base 10.  This is for JPython.)
1997-12-10 19:36:41 +00:00
Guido van Rossum e44a8d9987 Support uue and x-uue as short names for uuencode. 1997-12-10 18:54:36 +00:00
Guido van Rossum 9ab94c18d8 Doc strings and reformatting with 4 spaces bty Mitch Chapman.
Untabified and minor tweaks by me.
1997-12-10 16:17:39 +00:00
Guido van Rossum 5bdea89c89 # Typos in the comments giving the names of two recently added distributions. 1997-12-09 19:43:18 +00:00
Guido van Rossum b978d18fec Guess... :-) 1997-12-09 16:56:41 +00:00
Guido van Rossum 3d20986d96 Checking in ConfigParser.py -- I don't see a reason why this can't be
liberated.  This was originally written by Ken and later revamped by
Barry.
1997-12-09 16:10:31 +00:00
Guido van Rossum 7b8970ac88 Deleting ni.py; renamed to ni1.py, really. 1997-12-09 14:58:26 +00:00
Guido van Rossum 6599fb0917 Make close(), and hence __del__(), robust in the light of the world
being destroyed already.
1997-12-09 14:18:33 +00:00
Guido van Rossum 41999c164e Doc strings by Mitch Chapman (with a little reformatting).
Also reformatted the whole module with 4 spaces and no tabs.
1997-12-09 00:12:23 +00:00
Guido van Rossum 6a99984e79 Use long() instead of int() to compare mktime(localtime(t) with t... 1997-12-08 21:48:01 +00:00
Guido van Rossum dfa6790bd6 New re version from AMK 1997-12-08 17:12:06 +00:00
Guido van Rossum c5d2d51700 Apply the same change to classes without an __getinitargs__() method
as in pickle: the new instance is created without calling __init__().
1997-12-07 16:18:22 +00:00
Guido van Rossum 61de0ac4bb Reindented according to new standard, without tabs.
Also added one more os2 specific piece of code, by Jeff Rush.
1997-12-05 21:24:30 +00:00
Guido van Rossum 63cf3960df ospath.py has been obsolete for long enough. 1997-12-05 19:49:14 +00:00
Guido van Rossum e467be6511 When instantiating a class with no arguments and where the class does
not define __getinitargs__, bypass the __init__ constructor
completely.  This uses the trick of instantiating an empty dummy class
and then changing inst.__class__ to the real class.  This is done in
two places: once for the INST and once for the OBJ format code.

Also replaced the much outdated long doc string with a short summary
of the module; the information of that doc string is already
incorporated in the library reference manual.
1997-12-05 19:42:42 +00:00
Guido van Rossum 346f7af8ff Added doc strings and reindented according to new standard, without tabs.
(Like ntpath.py, this was contributed by "Charles G. Waldman" <cgw@pgt.com>)
1997-12-05 19:04:51 +00:00
Guido van Rossum 15e22e1c3a Added doc strings and reindented according to new standard, without tabs. 1997-12-05 19:03:01 +00:00
Guido van Rossum 7f9732880e Fix the exclusion of "config" in the methods copied from Pack to also
exclude "configure".
1997-12-05 17:05:04 +00:00
Guido van Rossum e612be5926 Patch my Marc Lemburg to fix urljoin("/a", "..") and urljoin("/a", "..#1"). 1997-12-03 22:38:56 +00:00
Guido van Rossum 3fa440ea91 Refinement of home for NT, courtesy Jeff Bauer. 1997-12-03 22:34:03 +00:00
Guido van Rossum ab76af3d65 Provide default for blocksize on retrbinary (Skip Montanaro). 1997-12-03 19:34:14 +00:00
Guido van Rossum 98ee50b5a4 More generated files for netbsd 1.x, by Anders Andersen. 1997-12-03 18:44:57 +00:00
Guido van Rossum 91221c29f2 Support for netbsd1 and freebsd3, after suggestions by Anders Andersen
and Jacques Vidrine.
1997-12-02 20:30:29 +00:00
Guido van Rossum c0f29c2d31 When a port is specified in an ftp:// URL, must convert it to a number! 1997-12-02 20:26:21 +00:00
Guido van Rossum 80f8be8901 Support for the "event" command, new in Tk 4.2.
By Case Roole.
1997-12-02 19:51:39 +00:00
Guido van Rossum 11fbef5f92 Sjoerd sez: global substitute \240 with \177. 1997-12-02 17:45:39 +00:00
Guido van Rossum 376467ada6 Added stropts.h to the list of files automatically regenerated. 1997-12-02 14:37:20 +00:00
Barry Warsaw 5284589097 Generated from Solaris 2.6's /usr/include/sys/stropts.h via
Tools/scripts/h2py.py.  This file contains many useful streamio(7)
constants, especially the ones that support passing open file
descriptors through a pipe: I_RECVFD and I_SENDFD.
1997-12-02 04:49:09 +00:00
Guido van Rossum 893a8cbae7 *** empty log message *** 1997-12-02 03:42:17 +00:00
Guido van Rossum cf4559a62e Added Pareto and Weibull distributions, courtesy Jeremy Hylton. 1997-12-02 02:47:39 +00:00
Barry Warsaw c99a239f42 Added strop.split tests when sep is None. 1997-12-02 00:30:04 +00:00
Guido van Rossum 06ba34c5d4 In string.split(), honor maxsplit (if > 0).
In string.splitfields(), ignore maxsplit if <= 0, rather than ignoring
maxsplit=0 but effectively treating negative numbers the same as
maxsplit=1.  Also made the test for maxsplit slightly more efficient
(set it to the length of the string when <= 0 so the test for its
presence can be omitted from the loop).
1997-12-01 15:25:19 +00:00
Barry Warsaw 58a88b3e34 _Environ(): Added __getinitargs__() method so os.environ.copy() works,
as does unpickling, as in: pickle.loads(pickle.dumps(os.environ)).

Hope this is right!  Don't shoot me Guido. :-)
1997-12-01 04:30:19 +00:00
Barry Warsaw 9181190c76 Added tests of strop.replace() 1997-11-29 00:25:30 +00:00
Guido van Rossum 0b23348aa9 The usual 1997-11-26 15:44:34 +00:00
Guido van Rossum e2d4dd194b Use fuzzy comparison from test_support to compare outcome of
pow(x,y,z) to pow(x,y)%z.
1997-11-24 22:24:22 +00:00
Guido van Rossum 8e9ebfd337 os2 patch by Jeff Rush 1997-11-22 21:53:48 +00:00
Guido van Rossum c0b93191e6 bind_class should return a value 1997-11-22 21:49:56 +00:00
Guido van Rossum be7c45eec4 New address parser by Ben Escoto replaces
Sjoerd Mullender's parseaddr()
1997-11-22 21:49:19 +00:00
Guido van Rossum e6c128f428 Use fstat if we can; write MAGIC into file last. 1997-11-22 21:48:26 +00:00
Guido van Rossum 7d5b99d8bf A new standard module, as discussed on comp.lang.python, to simplify
the writing of filters.

Typical use is:

    import fileinput
    for line in fileinput.input():
        process(line)

This iterates over the lines of all files listed in sys.argv[1:],
defaulting to sys.stdin if the list is empty or when a filename is
'-'.

There is also an option to use this to direct the output back to the
input files.
1997-11-21 17:12:59 +00:00
Barry Warsaw 3d96d522ec (Queue.Empty): When class based exceptions are in force, derive this
class from the standard base exception Exception.  Otherwise define
Queue.Empty as a string exception.

(Queue): 8-space to 4-space indentation conversion.  Also, basically
recast all method comments into docstrings.
1997-11-20 19:56:38 +00:00
Guido van Rossum bd1169a93e Add Martin von Loewis as the author of this module. 1997-11-19 19:02:09 +00:00
Guido van Rossum eef1d4e8b1 User-level locale module. A wrapper around _locale which adds
format(), str(), atof(), and atoi().  The last three are locale
sensitive versions of the corresponding standard functions (only for
numbers though); format() does general %[efg] formatting taking the
locale into account, optionally with thousands grouping.
1997-11-19 19:01:43 +00:00
Guido van Rossum 83600050d0 Assert that the proxies object passed in to the URLopener constructor
is indeed a dictionary (or a mapping).
1997-11-18 15:50:39 +00:00
Guido van Rossum 421c224044 Added docstrings (contributed by Martin von Loewis). 1997-11-18 15:47:55 +00:00
Guido van Rossum 5d68e8e312 Fixed case sensitivity of attributes (they are case *sensitive*). 1997-11-18 15:27:20 +00:00
Guido van Rossum a219efaa7b Sjoerd Mullender's xml parser (based on sgmllib, somewhat). 1997-11-18 15:09:54 +00:00
Guido van Rossum 368e06b6f0 Some restructuring.
All geometry manager methods that apply to a master widget instead of
to a slave widget have been moved to the Misc class, which is
inherited by all of Tk(), Toplevel() and Widget().  They have been
renamed to have their geometry manager name as a prefix,
e.g. pack_propagate(); the short names can still be used where
ambiguities are resolved so that pack has priority over place has
priority over grid (since this was the old rule).

Also, the method definitions in the Pack, Place and Grid classes now
all have their respective geometry manager name as a prefix
(e.g. pack_configure); the shorter names are aliases defined through
assignment.

A similar renaming has been done for all config() methods found
elsewhere; these have been renamed to configure() with config being
the alias (instead of the other way around).  (This may not make much
of a difference but the official Tk command name is now 'configure'
and it may help in debugging tracebacks.)

Finally, a new base class BaseWidget has been introduced, which
implements the methods common between Widget and Toplevel (the
difference between those two classes is that Toplevel has a different
__init__() but also that Toplevel doesn't inherit from Pack, Place or
Grid.
1997-11-07 20:38:49 +00:00
Guido van Rossum c1189eb524 Separate out a function pystones(loops=LOOPS) which runs the benchmark
and returns a (benchtime, stones) tuple.  The main() function now
calls this and prints the report.  Fred Drake's code.
1997-11-06 15:45:05 +00:00
Guido van Rossum f849291e2b Add __init__.py to test package. 1997-11-06 15:41:23 +00:00
Guido van Rossum bfa9f13e14 islink() returns false, but there is no constant false! Return 0 instead. 1997-11-04 18:40:53 +00:00
Guido van Rossum 19f44560f2 Use ``0'' instead of ``None'' to reset the underlying object in close
methods.  Using None causes problems if the destructor is called after
the __builtin__ module has already been destroyed (unfortunately, this
can happen!).  I can't just delete the object because it is actually
tested for (if self._sock: ...).  Setting it to 0 is a bit weird but
works.
1997-11-04 17:32:59 +00:00
Guido van Rossum e8d113976c Add empty __init__.py files to the test packages so the new policy
will recognize them.
1997-10-31 18:33:41 +00:00
Guido van Rossum 613418aa09 New version from Sjoerd, small bugfix + optimizations. 1997-10-30 15:27:37 +00:00
Guido van Rossum 0874f7fdaf Tests for tokenize.py (Ka-Ping Yee) 1997-10-27 22:15:06 +00:00
Guido van Rossum fefc922cef New, fixed version with proper r"..." and R"..." support from Ka-Ping. 1997-10-27 21:17:24 +00:00
Guido van Rossum 3b631775b2 Redone (by Ka-Ping) using the new re module, and adding recognition
for r"..." raw strings.  (And R"..." string support added by Guido.)
1997-10-27 20:44:15 +00:00
Guido van Rossum 036309b13e This should hopefully finally clean up the remaining __del__ related
problems with this module, even if an instance of a derived class is
kept alive longer than the urllib module itself...
1997-10-27 18:56:19 +00:00
Guido van Rossum af8d2bf4d8 Bugfix in match() -- the number of registers shouldn't be divided by two! 1997-10-27 18:17:19 +00:00
Guido van Rossum e6eef4b4a3 Use __dict__.update(state) instead of for loop over state.items() and
call to setattr().  This changes semantics, following the change
already implemented in pickle.

Also reindented a few lines properly.
1997-10-26 17:00:25 +00:00
Guido van Rossum 31626bce66 re -> regex conversions by Sjoerd. 1997-10-24 14:46:16 +00:00
Guido van Rossum f81e5b9c78 New module -- converts regex regular expressions to re style.
There are two ways to use this -- as a filter (e.g. using C-U M-| on a
regex string literal in an Emacs buffer) or from a Python program
which imports this as a module.  Read the doc string for more info,
and also some caveats (some cases aren't handled right).
1997-10-23 22:43:50 +00:00
Guido van Rossum 1fef181183 Although it's hard to be sure, I *think* this is a working conversion
from regex to re style regular expressions.  This should make sgmllib
and htmllib threadsafe, so I can now create a threaded version of
webchecker...
1997-10-23 19:09:21 +00:00
Guido van Rossum 57a68e08f9 Remove redundant import regsub. 1997-10-23 17:50:10 +00:00
Guido van Rossum 9694fcab53 Convert all remaining *simple* cases of regex usage to re usage. 1997-10-22 21:00:49 +00:00
Guido van Rossum 426916e50e Add pcre to the list of safe modules. 1997-10-22 20:56:32 +00:00
Guido van Rossum f7a8b45d71 Remove outdated comments. 1997-10-22 20:54:50 +00:00
Guido van Rossum 12f86ade21 Removed some unneeded imports, moved others around. 1997-10-22 20:52:53 +00:00
Guido van Rossum a8832b45e7 Removed unneeded imports of regex and regsub. 1997-10-22 20:50:37 +00:00
Guido van Rossum acfb82a530 Use re instead of regex. Also remove bogus return statement from __init__(). 1997-10-22 20:49:52 +00:00
Guido van Rossum 8566e474b4 Added pgrep() function, which is like grep/egrep/emgrep but uses Perl
syntax, by virtue of the new re module.
1997-10-22 20:44:58 +00:00