Commit Graph

8948 Commits

Author SHA1 Message Date
Brett Cannon 4f65331483 Limit the nesting depth of a tuple passed as the second argument to
isinstance() or issubclass() to the recursion limit of the interpreter.
2004-03-20 22:52:14 +00:00
Guido van Rossum 70ec0b42b5 Fix for SF 777848.
I've been bitten by this myself in the past half year.
I hope this fix is right.
I'll backport this to 2.3.
2004-03-20 22:18:03 +00:00
Tim Peters 27f49610af SF patch 508730 CGIHTTPServer execfile should save cwd
UNTESTED!!!

This simple two-line patch has been sitting on SF for more than 2 years.
I'm guessing it's because nobody knows how to test it -- I sure don't.
It doesn't look like you can get to this part of the code on Unixish
or Windows systems, so the "how to test it?" puzzle has more than one
part.  OTOH, if this is dead code, it doesn't matter either if I just
broke it <wink>.
2004-03-20 21:51:12 +00:00
Brett Cannon cc45466b8f Remove non-existent paths. 2004-03-20 21:31:33 +00:00
Brett Cannon 497331fa2b Fix how line endings were handled when iterating over a .pth file by stripping
all whitespace at the end of the path line.
2004-03-20 21:08:17 +00:00
Thomas Wouters 1e1305491b test_email: comment out two fail-test cases that no longer fail with the new
parser -- for now. Failure behaviour of the new parser(s) will change in any
case, so this will be revisited later anyway.
2004-03-20 20:29:50 +00:00
Tim Peters 934d31b1d3 Speed HMAC.copy() by installing a secret backdoor argument to
HMAC.__init__().  Adapted from SF patch 895445 "hmac.HMAC.copy() speedup"
by Trevor Perrin, who reported that this approach increased throughput
of his hmac-intensive app by 30%.
2004-03-20 20:11:29 +00:00
Thomas Wouters 0813d76cb0 Merge in Anthony's new parser code, from the anthony-parser-branch:
> ----------------------------
> revision 1.20.4.4
> date: 2003/06/12 09:14:17;  author: anthonybaxter;  state: Exp;  lines: +13 -6
> preamble is None when missing, not ''.
> Handle a couple of bogus formatted messages - now parses my main testsuite.
> Handle message/external-body.
> ----------------------------
> revision 1.20.4.3
> date: 2003/06/12 07:16:40;  author: anthonybaxter;  state: Exp;  lines: +6 -4
> epilogue-processing is now the same as the old parser - the newline at the
> end of the line with the --endboundary-- is included as part of the epilogue.
> Note that any whitespace after the boundary is _not_ part of the epilogue.
> ----------------------------
> revision 1.20.4.2
> date: 2003/06/12 06:39:09;  author: anthonybaxter;  state: Exp;  lines: +6 -4
> message/delivery-status fixed.
> HeaderParser fixed.
> ----------------------------
> revision 1.20.4.1
> date: 2003/06/12 06:08:56;  author: anthonybaxter;  state: Exp;  lines: +163 -129
> A work-in-progress snapshot of the new parser. A couple of known problems:
>
> - first (blank) line of MIME epilogues is being consumed
> - message/delivery-status isn't quite right
>
> It still needs a lot of cleanup, but right now it parses a whole lot of
> badness that the old parser failed on. I also need to think about adding
> back the old 'strict' flag in some way.
> =============================================================================
2004-03-20 17:31:29 +00:00
Fred Drake 6fd0b0d5ba commit the portion of PyXML patch #919008 that is relevant to the
standard library:
str() of xml.sax.SAXParseException should not fail if the line and/or
column number returned by the locator are None
(tests added)
2004-03-20 08:15:30 +00:00
Hye-Shik Chang 5c5316f111 Add a new unicode codec: ptcp154 (Kazakh) 2004-03-19 08:06:07 +00:00
Gregory P. Smith 1281f76606 * supply a more useful error message when append() is called on the
wrong type of database in dbshelve.
* fix a typo in the exception name when checking args
2004-03-16 18:50:26 +00:00
Gregory P. Smith bce64ec086 bugfix for people executing test_all to run the test suite. (call the
correct function)
2004-03-16 07:07:06 +00:00
Kurt B. Kaiser 6e4620bfb1 1. Make builtin foreground Royal Purple instead of Barney Purple.
2. Touch up help.txt

M config-highlight.def
M help.txt
2004-03-16 03:36:41 +00:00
Walter Dörwald cd1e8a9485 Port test_binascii.py to PyUnit and enhance tests.
Code coverage for binascii.c is at 92%.
From SF patch #736962.
2004-03-15 12:07:38 +00:00
Kurt B. Kaiser 0bc3d9857f 1. Bug in Patch 805830 fixed by Nigel Rowe
2. Convert 1/0 to True/False
3. Fix a couple of long lines

M ColorDelegator.py
M NEWS.txt
2004-03-15 04:26:37 +00:00
Raymond Hettinger deb4da500b Add missing docstrings. 2004-03-14 07:54:37 +00:00
Raymond Hettinger 49f9bd15ff SF feature request #686323: Minor array module enhancements
array.extend() now accepts iterable arguments implements as a series
of appends.  Besides being a user convenience and matching the behavior
for lists, this the saves memory and cycles that would be used to
create a temporary array object.
2004-03-14 05:43:59 +00:00
Jack Jansen 118e1277a6 Two issues spotted by Ronald OUssoren:
- there were no accessor functions for the global per-database fields
- packages and their dependencies were installed in order in stead
  of in reverse order.
2004-03-13 23:50:48 +00:00
Jack Jansen c32cec14b4 Don't use "dict" as a variable, it shadows the builtin. Spotted by
Bob Ippolito.
2004-03-13 23:32:47 +00:00
Jack Jansen 0576d0a48a Force option should be applied to a single package, not recursively
to its dependencies. Fixes #733819.
2004-03-13 23:03:38 +00:00
Raymond Hettinger 2d95f1ad57 SF patch #911431: robot.txt must be robots.txt
(Contributed by George Yoshida.)
2004-03-13 20:27:23 +00:00
Raymond Hettinger 3aa82c07f7 SF bug #910986: copy.copy fails for array.array
Added support for the copy module.
2004-03-13 18:18:51 +00:00
Jack Jansen 989ddc0709 - Added a downloader using urllib2 in stead of curl, based on code
donated by Kevin Ollivier. This is now the default downloader.
- Added a watcher mechanism, whereby downloaders and unpackers (and,
later builders) can give status feedback to the user. When running
pimp as a command line tool in verbose mode print this output.
2004-03-11 23:03:59 +00:00
Neil Schemenauer 6cbba50a43 Make test_coercion.py less sensitive to platform fp quirks. Closes
SF bug #678265.
2004-03-10 17:30:03 +00:00
Raymond Hettinger ef9bf4031a Tidied up the implementations of reversed (including the custom ones
for xrange and list objects).

* list.__reversed__ now checks the length of the sequence object before
  calling PyList_GET_ITEM() because the mutable could have changed length.

* all three implementations are now tranparent with respect to length and
  maintain the invariant len(it) == len(list(it)) even when the underlying
  sequence mutates.

* __builtin__.reversed() now frees the underlying sequence as soon
  as the iterator is exhausted.

* the code paths were rearranged so that the most common paths
  do not require a jump.
2004-03-10 10:10:42 +00:00
Raymond Hettinger d2c36261a2 Eliminate the double reverse option. It's only use case
was academic and it was potentially confusing to use.
2004-03-10 08:32:47 +00:00
Brett Cannon 4b6b7f1515 Remove calls to currentThread() in _Condition methods that were side-effect.
Side-effects were deemed unnecessary and were causing problems at shutdown
time when threads were catching exceptions at start time and then triggering
exceptions trying to call currentThread() after gc'ed.  Masked the initial
exception which was deemed bad.

Fixes bug #754449 .
2004-03-08 22:18:57 +00:00
Raymond Hettinger 6ec099658a SF patch #907403: Improvements to cStringIO.writelines()
The writelines() method now accepts any iterable argument and writes
the lines one at a time rather than using ''.join(lines) followed by
a single write.  Results in considerable memory savings and makes
the method suitable for use with generator expressions.
2004-03-08 18:17:31 +00:00
Kurt B. Kaiser 73360a3e61 Add a highlight theme for builtin keywords. Python Patch 805830 Nigel Rowe
M ClassBrowser.py
M ColorDelegator.py
M EditorWindow.py
M NEWS.txt
M PyShell.py
M TreeWidget.py
M config-highlight.def
M configDialog.py
M configHandler.py
2004-03-08 18:15:31 +00:00
Vinay Sajip 4102478f46 Removed spurious import statement 2004-03-08 16:57:19 +00:00
Raymond Hettinger f0e3569a28 Refactor the copy dispatcher code in copy.py. Simplifies and shortens
the code by grouping common cases together.
2004-03-08 05:59:33 +00:00
Brett Cannon 8172ac3d15 Deal with possible case of having time.tzname[1] containing UTC or GMT.
Since it is known ahead of time that UTC and GMT always have no DST adjustment
then just set the isdst value to 0 even if tzname[0] == tzname[1] .
Fixes bug #897817 .
2004-03-07 23:16:27 +00:00
Raymond Hettinger dd80f76265 SF patch #910929: Optimize list comprehensions
Add a new opcode, LIST_APPEND, and apply it to the code generation for
list comprehensions.  Reduces the per-loop overhead by about a third.
2004-03-07 07:31:06 +00:00
Raymond Hettinger 31017aed36 SF #904720: dict.update should take a 2-tuple sequence like dict.__init_
(Championed by Bob Ippolito.)

The update() method for mappings now accepts all the same argument forms
as the dict() constructor.  This includes item lists and/or keyword
arguments.
2004-03-04 08:25:44 +00:00
Sjoerd Mullender 47db16580a Fixed invalid syntax. 2004-03-03 16:34:31 +00:00
Brett Cannon d1080a3418 Have strftime() check its time tuple argument to make sure the tuple's values
are within proper boundaries as specified in the docs.

This can break possible code (datetime module needed changing, for instance)
that uses 0 for values that need to be greater 1 or greater (month, day, and
day of year).

Fixes bug #897625.
2004-03-02 04:38:10 +00:00
Raymond Hettinger 0a4977c2f3 Replace left(), right(), and __reversed__() with the more general purpose
__getitem__() and __setitem__().

Simplifies the API, reduces the code size, adds flexibility, and makes
deques work with bisect.bisect(), random.shuffle(), and random.sample().
2004-03-01 23:16:22 +00:00
Neal Norwitz 9a8d55e4a1 Cleanup: remove test file after it is used. 2004-02-29 15:37:50 +00:00
Raymond Hettinger 738ec90ca1 Improvements to collections.deque():
* Add doctests for the examples in the library reference.
* Add two methods, left() and right(), modeled after deques in C++ STL.
* Apply the new method to asynchat.py.
* Add comparison operators to make deques more substitutable for lists.
* Replace the LookupErrors with IndexErrors to more closely match lists.
2004-02-29 02:15:56 +00:00
Jack Jansen 192bd966ad getDefaultDatabase() should be a toplevel function, not a method of the
preferences object.
2004-02-28 23:18:43 +00:00
Jack Jansen afd63b9c40 Started on version 0.4: better scheme for finding correct database:
- Try not only "darwin-7.X.Y" but also "darwin-7.X" and "darwin-7",
  so far we've never had to create anew database for a minor release.
- Distinguish between the various different installs (user-installed
  MacPython, apple-installed MacPython, other).
2004-02-28 22:34:02 +00:00
Vinay Sajip 3f74284e1b Minor documentation changes 2004-02-28 16:07:46 +00:00
Marc-André Lemburg d594849c42 Ignore sizehint argument. Fixes SF #844561. 2004-02-26 15:22:17 +00:00
Gregory P. Smith a7befda8d8 Fixes SF bug # 778421
* Fixed a bug in the compatibility interface set_location() method
   where it would not properly search to the next nearest key when
   used on BTree databases.  [SF bug id 788421]
 * Fixed a bug in the compatibility interface set_location() method
   where it could crash when looking up keys in a hash or recno
   format database due to an incorrect free().
2004-02-26 10:07:14 +00:00
Hye-Shik Chang 904de5b734 Make _spawn_posix be ready for EINTR. waitpid(2) can be interrupted
by SIGCHLD or sth because no signal is masked before. This fixes
an optimized installation problem on FreeBSD libpthread.
2004-02-24 23:54:17 +00:00
Jeremy Hylton b3ee6f9921 Fix two bugs in the new do_open() implementation for HTTPHandler.
Invoke the standard error handlers for non-200 responses.

Always supply a "Connection: close" header to prevent the server from
leaving the connection open.  Downstream users of the socket may
attempt recv()/read() with no arguments, which would block if the
connection were kept open.
2004-02-24 19:40:35 +00:00
Jeremy Hylton 2b55d35850 Reflow long line. 2004-02-23 17:27:57 +00:00
Marc-André Lemburg 361d66de5d Fix wrong character mapping in koi8_u: SF bug #902501. 2004-02-23 09:00:43 +00:00
Vinay Sajip f42d95ebd1 Added close() (which flushes) to BufferingHandler and tidied MemoryHandler.close() [SF #901330] 2004-02-21 22:14:34 +00:00
Vinay Sajip 3f9f84def4 Handler close() functions call flush() [SF #901330] 2004-02-21 22:12:32 +00:00
Samuele Pedroni 8036c83630 adding passing test. testing for g(*Nothing()) where Nothing is a user-defined iterator. 2004-02-21 21:03:30 +00:00
Thomas Heller 0bc9c919e8 Use the right wininstXX.exe, depending on
msvccompiler.get_build_version().

Distributions without a pre-install-script didn't work any longer, we
must at least provide the terminating NUL character.
2004-02-20 19:38:50 +00:00
Thomas Heller 612371dcb3 wininst-6.exe and wininst-7.1.exe are in CVS, so that they can be
included in Python distributions for systems other than Windows.
Windows installers can be build on non-Windows systems as long as they
only include pure python module distributions.
2004-02-20 18:33:38 +00:00
Thomas Heller 90b0f1c602 wininst.exe is no longer used - we now need wininst-6.exe or wininst-7.1.exe. 2004-02-20 18:26:55 +00:00
Thomas Heller 4ae4f83954 Recompiled the binary wininst.exe.
Patch #892660 from Mark Hammond, for distutils bdist_wininst command.

install.c: support for a 'pre-install-script', run before anything has
been installed. Provides a 'message_box' module function for use by
either the pre-install or post-install scripts.

bdist_wininst.py: support for pre-install script. Typo (build->built),
fixes so that --target-version can still work, even when the
distribution has extension modules - in this case, we insist on
--skip-build, as we still can't actually build other versions.
2004-02-20 14:44:32 +00:00
Thomas Heller a19cdad6dc Patch #892660 from Mark Hammond, for distutils bdist_wininst command.
install.c: support for a 'pre-install-script', run before anything has
been installed. Provides a 'message_box' module function for use by
either the pre-install or post-install scripts.

bdist_wininst.py: support for pre-install script. Typo (build->built),
fixes so that --target-version can still work, even when the
distribution has extension modules - in this case, we insist on
--skip-build, as we still can't actually build other versions.
2004-02-20 14:43:21 +00:00
Vinay Sajip bb99058898 Socket handler closed prior to end of test. 2004-02-20 13:19:16 +00:00
Vinay Sajip ed6bb1414c Copyright year & version number/version date changes.
Exception traceback text is now cached.
Closing a handler now removes it from the internal _handlers list.
Handlers now chain to Handler.close() from their close() methods.
Exception info can be passed as a tuple in exc_info.
shutdown() is registered to be called at application exit.
2004-02-20 13:18:36 +00:00
Vinay Sajip 48cfe38e79 Copyright year change.
Corrections to comments.
Tracebacks can now be sent via SocketHandler.
SocketHandler now uses exponential backoff strategy.
Handlers now chain to Handler.close() from their close() methods.
2004-02-20 13:17:27 +00:00
Vinay Sajip 326441e72e Copyright year change.
Corrections to comments.
Added RESET_ERROR definition.
2004-02-20 13:16:36 +00:00
Guido van Rossum bbca8da3ca Fix two small bugs: (1) on Windows, pathname munging didn't work
right; (2) write_results_file() didn't return a tuple of two ints when
it couldn't create the file.  Will backport.
2004-02-19 19:16:50 +00:00
Neal Norwitz 63dfece675 Get test to work when run from regrtest (add test_main), remove all CRs (^M)s 2004-02-19 02:37:29 +00:00
David Ascher e2b4b32025 Implementation of patch 869468
Allow the user to create Tkinter.Tcl objects which are
just like Tkinter.Tk objects except that they do not
initialize Tk. This is useful in circumstances where the
script is being run on machines that do not have an X
server running -- in those cases, Tk initialization fails,
even if no window is ever created.

Includes documentation change and tests.

Tested on Linux, Solaris and Windows.

Reviewed by Martin von Loewis.
2004-02-18 05:59:53 +00:00
Fred Drake f06116dcab commentary about how bad ConfigParser is doesn't help here, and the
suggested approach to dealing with it isn't a good one; we need a
better general purpose config reader, not a distutils-specific reader
2004-02-17 22:35:19 +00:00
Martin v. Löwis a79449e7a2 Patch #711838: Allow non-anonymous ftp urls in urllib2.
Backported to 2.3.
2004-02-15 21:19:18 +00:00
Martin v. Löwis 7db04e7c48 Patch #817379: Allow for absolute ftp paths.
Backported to 2.3.
2004-02-15 20:51:39 +00:00
Neil Schemenauer 32d23c9264 Fix typo. 2004-02-15 16:43:20 +00:00
Fred Drake 55cf434735 further testing indicates that the simplified version of the test
(re-using an existing test object class) no longer triggered the
original segfault when the fix was backed out; restoring the local
test object class to make the test effective

the assignment of the ref created at the end does not affect the test,
since the segfault happended before weakref.ref() returned; removing
the assignment
2004-02-13 19:21:57 +00:00
Hye-Shik Chang 4a8d42f73f We have cp932 support in standard distribution now. And there's now
no major codepages unsupported by Python, so remove the eg. case.
2004-02-13 07:14:13 +00:00
Fred Drake 61dafcb6ca use existing test object instead of defining a new class 2004-02-12 19:30:17 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Skip Montanaro 05eb40128e Fix indentation error in testGetServByName and rewrite loop to avoid clumsy
sentinel variable
2004-02-10 15:51:15 +00:00
Raymond Hettinger 029dba5a40 Make reversed() transparent with respect to length. 2004-02-10 09:33:39 +00:00
Raymond Hettinger 5cab2e3a88 Give itertools.repeat() a length method. 2004-02-10 09:25:40 +00:00
Raymond Hettinger 3dc3484ac8 SF bug #892492: Multiple close() for asyncore.dispatcher.
(Contributed by Alexey Klimkin.)

Don't keep the file descriptor after the channel is deleted.
2004-02-08 11:32:50 +00:00
Raymond Hettinger 06353f76be Let reversed() work with itself. 2004-02-08 10:49:42 +00:00
Raymond Hettinger ee33b27ef0 Make deque.rotate() smarter. Beef-up related tests. 2004-02-08 04:05:26 +00:00
Barry Warsaw 3b6d025d9b Patch #868499, adds -T option for code coverage. The implementation is a
fairly simpleminded adaptation of Zope3's test.py -T flag.

I also changed some booleans to use True/False where appropriate.
2004-02-07 22:43:03 +00:00
Raymond Hettinger 5c5eb86347 * Incorporate Skip's suggestions for documentation (explain the word deque
comes from and show the differences from lists).
* Add a rotate() method.
2004-02-07 21:13:00 +00:00
Skip Montanaro b31764837d no longer support linux1 platform 2004-02-07 20:03:34 +00:00
Skip Montanaro b23b7698cc no longer support sunos4 platform 2004-02-07 20:01:11 +00:00
Raymond Hettinger ac093c6af0 Use collection.deque() instead of a list for a FIFO queue. 2004-02-07 03:19:10 +00:00
Raymond Hettinger c058fd14a9 * Fix ref counting in extend() and extendleft().
* Let deques support reversed().
2004-02-07 02:45:22 +00:00
Raymond Hettinger b5ba8d749d Lists work better when popping from the right. 2004-02-07 02:16:24 +00:00
Raymond Hettinger 3ba85c2e8a Have deques support high volume loads. 2004-02-06 19:04:56 +00:00
Walter Dörwald 7dcf9f89d3 Fix test failure message (from SF patch #885008) 2004-02-06 18:30:31 +00:00
Hye-Shik Chang 0a83778572 Back rev 1.3 out per Raymond's request. 2004-02-06 04:40:56 +00:00
Hye-Shik Chang d310f13cd2 Simple is better than complex. 2004-02-06 02:52:15 +00:00
Walter Dörwald cd736e71a3 Fix reallocation bug in unicode.translate(): The code was comparing
characters instead of character pointers to determine space requirements.
2004-02-05 17:36:00 +00:00
Fred Drake bc875f5a36 Allocating a new weakref object can cause existing weakref objects for
the same object to be collected by the cyclic GC support if they are
only referenced by a cycle.  If the weakref being collected was one of
the weakrefs without callbacks, some local variables for the
constructor became invalid and have to be re-computed.

The test caused a segfault under a debug build without the fix applied.
2004-02-04 23:14:14 +00:00
Fred Drake ea2adc9c80 - add tests that exercise fixes for the PyWeakref_NewRef() and
PyWeakref_NewProxy() constructors from the C API
- elaborate the getweakrefcount() and getweakrefs() tests slightly
2004-02-03 19:56:46 +00:00
Hye-Shik Chang ff83c2bacc Fix input() builtin function to respect compiler flags.
(SF patch 876178, patch by mwh, unittest by perky)
2004-02-02 13:39:01 +00:00
Raymond Hettinger 756b3f3c15 * Move collections.deque() in from the sandbox
* Add unittests, newsitem, and whatsnew
* Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py
* Docs are forthcoming
2004-01-29 06:37:52 +00:00
Fred Drake 4e9e7a6140 don't wrap lines too late by default
closes SF bug #842213
2004-01-26 16:42:30 +00:00
Kurt B. Kaiser 7663729ec7 There was an error in the Tk error dialog fix at Rev 1.84 which caused starting
w/o the subprocess to fail.  Check in a fix to IDLE and IDLEfork.

M PyShell.py

Backport candidate, combine with previous.
2004-01-21 22:10:01 +00:00
Kurt B. Kaiser d6ab77d27d rpc.py:SocketIO - Large modules were generating large pickles when downloaded
to the execution server.  The return of the OK response from the subprocess
initialization was interfering and causing the sending socket to be not
ready.  Add an IO ready test to fix this.  Moved the polling IO ready test
into pollpacket().

M NEWS.txt
M rpc.py

Backport candidate.
2004-01-21 19:21:11 +00:00
Kurt B. Kaiser af3eb87802 Added a Tk error dialog to run.py inform the user if the subprocess can't
connect to the user GUI process.  Added a timeout to the GUI's listening
socket.  Added Tk error dialogs to PyShell.py to announce a failure to bind
the port or connect to the subprocess.  Clean up error handling during
connection initiation phase.  This is an update of Python Patch 778323.

M NEWS.txt
M PyShell.py
M ScriptBinding.py
M run.py

Backport candidate.
2004-01-21 18:54:30 +00:00
Raymond Hettinger 734fb5724f Add a Guido inspired example for groupby(). 2004-01-20 20:04:40 +00:00
Marc-André Lemburg c83dddf7fe Let the default encodings search function lookup aliases before trying the codec import. This allows applications to install codecs which override (non-special-cased) builtin codecs. 2004-01-20 09:40:14 +00:00
Marc-André Lemburg 5c94d33077 Add some more code page aliases needed for completeness. 2004-01-20 09:38:52 +00:00