Commit Graph

9137 Commits

Author SHA1 Message Date
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
Hye-Shik Chang b619e4b36c Fix a typo: s/iso_3022/iso2022/ 2004-01-20 09:33:30 +00:00
Hye-Shik Chang a5e719e081 Test not the standard utf-8 codec but gb18030 which is the most complex
codec in multibytecodec consumers.
2004-01-20 09:11:48 +00:00
Tim Peters 1301892715 For whatever reason, these files had \r\r\n line endings on Windows,
meaning they must have been checked in to CVS from a Linuxish box with
Windowish \r\n line endings to begin with.
2004-01-18 21:03:23 +00:00
Tim Peters 8279170ed2 Revert another local change that snuck into a whitespace normalization
patch.
2004-01-18 20:39:35 +00:00
Tim Peters 58eb11cf62 Whitespace normalization. 2004-01-18 20:29:55 +00:00
Hye-Shik Chang 3e2a306920 Add CJK codecs support as discussed on python-dev. (SF #873597)
Several style fixes are suggested by Martin v. Loewis and
Marc-Andre Lemburg. Thanks!
2004-01-17 14:29:29 +00:00
Gregory P. Smith e33aef7b15 __init__.py: keep it compatible with older python (True and False == 1 and 0)
test_basics.py: updated for the set_get_returns_none() default of 2 change.
2004-01-13 19:59:57 +00:00
Barry Warsaw 8f799e4c3a __all__: Remove freenet_b64encode and freenet_b64decode. 2004-01-07 22:32:12 +00:00
Raymond Hettinger 0c4102760c SF Patch #864863: Bisect C implementation
(Contributed by Dmitry Vasiliev.)
2004-01-05 10:13:35 +00:00
Hye-Shik Chang 75c00efcc7 [SF #866875] Add a specialized routine for one character
separaters on str.split() and str.rsplit().
2004-01-05 00:29:51 +00:00
Raymond Hettinger d73ef06cd3 Exercise sorted() where possible 2004-01-04 11:14:51 +00:00
Raymond Hettinger 816ed1b0bd SF patch #868736: Disable GC for timeit
Make timings more consistent by temporarily disabling GC.
2004-01-04 03:47:51 +00:00
Barry Warsaw 4f019d3b47 More complete code coverage, including testing the new RFC 3548 support. 2004-01-04 01:13:02 +00:00
Barry Warsaw 4c904d1bf7 Added more complete RFC 3548 support for Base64, Base32, and Base16
encoding and decoding, including optional case folding and optional
alternative alphabets.
2004-01-04 01:12:26 +00:00
Alex Martelli b993b067d2 The script now takes an optional command-line argument to specify how many
loops to run (default remains 50,000 if no argument is specified).
2004-01-02 17:11:54 +00:00
Andrew M. Kuchling 6e4f7a82da [Bug #812325 ] tarfile.close() can write out more bytes to the output
than are specified by the buffer size.  The patch calls .__write()
   to ensure that any full blocks are written out.
2004-01-02 15:44:29 +00:00
Kurt B. Kaiser e9802a301d - Print correct exception even if source file changed since shell was
restarted.  IDLEfork Patch 869012 Noam Raphael

Modified Files:
	NEWS.txt run.py
2004-01-02 04:04:04 +00:00
Raymond Hettinger 74bb7f03b1 SF Patch 681780: Faster commonprefix (OS independent)
Improved based on discussions at:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252177
http://groups.google.com/groups?th=fc7b54f11af6b24e&seekm=bss2so$om$00$1@news.t-online.com
2003-12-31 22:44:29 +00:00
Raymond Hettinger 6e70accaff Strengthen the test for hash effectiveness 2003-12-31 02:01:33 +00:00
Barry Warsaw 4a44293735 Fixes to support CJKCodecs as per SF bug #852347. Actually, this
patch removes dependencies on the old unsupported KoreanCodecs package
and the alternative JapaneseCodecs package.  Since both of those
provide aliases for their codecs, this removal just makes the generic
codec names work.

We needed to make slight changes to __init__() as well.

This will be backported to Python 2.3 when its branch freeze is over.
2003-12-30 16:52:25 +00:00
Barry Warsaw 339270e6f5 Bump version number to 2.5.5 2003-12-30 16:49:40 +00:00
Andrew M. Kuchling b386f6a509 As part of fixing bug #829532, add a test case that exercises os.makedirs 2003-12-23 16:36:11 +00:00
Andrew M. Kuchling 6fccc8a9ec [Bug #829532] Invoking os.makedirs() with an argument that contains a
directory name with a single dot fails.  The patch skips creating
    directories named os.curdir. (Patch by Bram Moolenaar)

2.3 bugfix candidate.
2003-12-23 16:33:28 +00:00
Hye-Shik Chang 7fc4cf57b8 Fix unicode.rsplit()'s bug that ignores separater on the end of string when
using specialized splitter for 1 char sep.
2003-12-23 09:10:16 +00:00
Raymond Hettinger 9014560412 Make sure the UserDict copies do not share the same underlying
dictionary as the original.  This parallels MvL's change to
Lib/os.py 1.56.

Backport candidate.
2003-12-21 22:19:08 +00:00
Walter Dörwald 893020b59b Remove self from the arguments for the function add_type().
Backport candidate.
2003-12-19 18:15:10 +00:00
Hye-Shik Chang 8d2e08dcdf Enable some unittests on FreeBSD.
test__locale: add typical POSIX-style full locale names.
test_locale: use en_US.US-ASCII on FreeBSD.
2003-12-19 01:16:03 +00:00
Jeremy Hylton e708fbd286 Remove methods that are no longer called by urllib2. 2003-12-17 20:47:28 +00:00
Raymond Hettinger 64958a15d7 Guido grants a Christmas wish:
sorted() becomes a regular function instead of a classmethod.
2003-12-17 20:43:33 +00:00
Jeremy Hylton df38ea9c29 Add methods to MockHTTPClass for modern httplib interface.
Replace lots of assert_(x == y) with assertEqual(x, y).
2003-12-17 20:42:38 +00:00
Jeremy Hylton 023518a6a8 Rewrite AbstractHTTPHandler to use modern httplib interface.
The chief benefit of this change is that requests will now use
HTTP/1.1 instead of HTTP/1.0.  Bump the module version number as part
of the change.

There are two possible incompatibilities that we'll need to watch out
for when we get to an alpha release.  We may get a different class of
exceptions out of httplib, and the do_open() method changed its
signature.  The latter is only important if anyone actually subclasses
AbstractHTTPHandler.
2003-12-17 18:52:16 +00:00
Hye-Shik Chang eebb641f23 Add rsplit method for UserString, too.
(Spotted by Raymond Hettinger)
2003-12-15 19:46:09 +00:00
Hye-Shik Chang 3ae811b57d Add rsplit method for str and unicode builtin types.
SF feature request #801847.
Original patch is written by Sean Reifschneider.
2003-12-15 18:49:53 +00:00
Jeremy Hylton dce391cb39 Remove __del__ methods to avoid creating uncollectable cyclic trash.
Keep close() methods for backwards compatibility.

Does any call close() explicitly?
2003-12-15 16:08:48 +00:00
Walter Dörwald c2fcf9bb6b Make the module docstring a raw string, so that the backslash in
"read until end of line ('\n') or EOF" will be treated literally.
Fixes SF bug #860155.
2003-12-15 10:16:09 +00:00
Jeremy Hylton c1be59f40a SF patch 852995: add processors feature to urllib2
John J. Lee writes: "the patch makes it possible to implement
functionality like HTTP cookie handling, Refresh handling,
etc. etc. using handler objects. At the moment urllib2's handler
objects aren't quite up to the job, which results in a lot of
cut-n-paste and subclassing. I believe the changes are
backwards-compatible, with the exception of people who've
reimplemented build_opener()'s functionality -- those people would
need to call opener.add_handler(HTTPErrorProcessor).

The main change is allowing handlers to implement
methods like:

http_request(request)
http_response(request, response)

In addition to the usual

http_open(request)
http_error{_*}(...)
"

Note that the change isn't well documented at least in part because
handlers aren't well documented at all.  Need to fix this.

Add a bunch of new tests.  It appears that none of these tests
actually use the network, so they don't need to be guarded by a
resource flag.
2003-12-14 05:27:34 +00:00
Neal Norwitz 328f338196 SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald 2003-12-13 22:43:34 +00:00
Walter Dörwald b167b04a2e Add tests to test_weakref.py to bring code coverage in _weakref.c up to 100%.
Port test_md5.py to PyUnit.

(Written by Neal Norwitz; from SF patch 736962)

(Backport candidate)
2003-12-11 12:34:05 +00:00
Jack Jansen 73b94da93f Wrapper modules for _Launch and _OSA weren't added yet. Fixed. 2003-12-09 15:07:01 +00:00
Walter Dörwald 1dde95dffa Move list and tuple tests from test_types.py to their own scripts:
test_tuple.py and test_list.py. Common tests for tuple, list and UserList
are shared (in seq_tests.py and list_tests.py). Port tests to PyUnit.
(From SF patch #736962)
2003-12-08 11:38:45 +00:00
Raymond Hettinger d25c1c6351 Implement itertools.groupby()
Original idea by Guido van Rossum.
Idea for skipable inner iterators by Raymond Hettinger.
Idea for argument order and identity function default by Alex Martelli.
Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger).
2003-12-06 16:23:06 +00:00
Steve Purcell b8d5f245b7 Variation of Thomas Heller's patch (722638) for improving readability
of test failure output.

Irrelevant traceback levels are pruned from formatted traceback strings.
2003-12-06 13:03:13 +00:00
Jack Jansen da78a5d5b6 Finished update to universal header 3.4.2. 2003-12-05 23:59:37 +00:00
Jack Jansen 5a4071ac91 Reverting to previous version, which works. And I don't really care about
the new waste functionality because it's probably going to be dropped
anyway.
2003-12-05 23:51:54 +00:00
Thomas Heller 9436a75e4d Compile the files in the same order they are passed to the compiler.
Use case: Sometimes 'compiling' source files (with SWIG, for example)
creates additionl files which included by later sources.  The win32all
setup script requires this.

There is no SF item for this, but it was discussed on distutils-sig:
http://mail.python.org/pipermail/distutils-sig/2003-November/003514.html
2003-12-05 20:12:23 +00:00
Raymond Hettinger f477c88450 SF bug #849662. Dramatically, improve comparison speed for "if shl == None". 2003-12-04 20:04:09 +00:00
Brett Cannon edfb30258e Fix error in exception message. 2003-12-04 19:28:06 +00:00
Michael W. Hudson 9da1efb5ae Remove extra copy of test_key_with_exception that somehow appeared
during a CVS merge.
2003-12-04 11:41:24 +00:00
Michael W. Hudson 1df0f654e8 Fixes and tests for various "holding pointers when arbitrary Python code
can run" bugs as discussed in

[ 848856 ] couple of new list.sort bugs
2003-12-04 11:25:46 +00:00
Tim Peters c6c5ece7e2 Typo repair; added some comments and horizontal whitespace. 2003-12-04 05:39:43 +00:00
Jack Jansen fe3fe4adb5 Adding an interface to the high-level Open Scripting Architecture,
by request of Donovan Preston. In return, he promised to use this
to create a Python OSA component, which would turn Python
into a first-class OSA scripting language (like AppleScript itself).
2003-12-03 22:34:19 +00:00
Mark Hammond 2e8624c21a Fix test_unicode_file errors on platforms without Unicode file support,
by setting TESTFN_UNICODE_UNENCODEABLE on these platforms.
test_unicode_file only attempts to use the name for testing if not None.
2003-12-03 22:16:47 +00:00
Walter Dörwald c8de4585a6 Add parameters indent, width and depth to pprint.pprint() and pprint.pformat()
and pass them along to the PrettyPrinter constructor.
2003-12-03 20:26:05 +00:00
Walter Dörwald 7a7ede54d4 Patch #750542: pprint now will pretty print subclasses of list, tuple
and dict too, as long as they don't overwrite __repr__().
2003-12-03 20:15:28 +00:00
Guido van Rossum 291481b4db Reduce the size of Big String and Big Binary tests to 2**14 (minus one
for Big String).  This should make the tests pass on Win98SE.  Note
that the docs only promise lengths up to 2048.  Unfortunately this no
longer tests for the segfault I was seeing earlier, but I'm confident
I've nailed that one. :-)  Fixes SF 852281.  Will backport to 2.3.
2003-12-03 15:24:02 +00:00
Mark Hammond 6d459725a3 Add test for bug "[ 846133 ] os.chmod/os.utime/shutil do not work with
unicode filenames"
Reorganize tests into functions so more combinations of
unicode/encoded/ascii can be tested, and while I was at it, upgrade to
unittest based test.
2003-12-03 01:29:56 +00:00
Mark Hammond b337dd903b Add TESTFN_UNICODE_UNENCODEABLE, a unicode filename that can not be
encoded using the default file system encoding.
2003-12-03 01:27:23 +00:00
Jack Jansen 7d0a609e6f An interface to the LaunchServices API. 2003-12-02 23:01:43 +00:00
Andrew MacIntyre 89f9865b91 OS/2+EMX: make the link() emulation available as os.link() 2003-12-02 12:33:01 +00:00
Andrew MacIntyre eb477f05cf EMX lacks an implementation of link(). As Mailman wants os.link() to
implement its locking scheme, this module implements a crude link() by
way of copying the source to the destination provided the destination
doesn't already exist.
2003-12-02 12:31:09 +00:00
Andrew MacIntyre 2e8a6e0ec6 To find the curses extension as a DLL (on OS/2), we need to adjust the
library search path to include the extension directory.  Without this,
the curses_panel extension can't find the curses extension/DLL, which
exports some curses symbols to it.
2003-12-02 12:27:25 +00:00
Andrew MacIntyre 63ee110cf7 use same compiler switches as core for extensions 2003-12-02 12:17:59 +00:00
Raymond Hettinger 70ef8692a1 SF patch #852140: keyword.py - use __contains__ and bool
Use a set instead of dict with values equal to one.
2003-12-02 07:48:15 +00:00
Martin v. Löwis 85f48e3b9b Convert path objects to strings in askdirectory. Fixes #852314.
Backported to 2.3.
2003-12-01 21:04:22 +00:00
Raymond Hettinger 3375fc5a3b Apply extract functions instead of lambda. 2003-12-01 20:12:15 +00:00
Raymond Hettinger 0ad142aba0 Revert previous change. MAL preferred the old version. 2003-12-01 13:26:46 +00:00
Raymond Hettinger 166958b5df As discussed on python-dev, added two extractor functions to the
operator module.
2003-12-01 13:18:39 +00:00
Raymond Hettinger a45517065a Simplifed the code. 2003-12-01 10:41:02 +00:00
Guido van Rossum 0a18552b29 Add testcases for _winreg segfault (SF 851056). 2003-11-30 22:46:18 +00:00
Guido van Rossum 457bf91a7f Fix a bug discovered by Kalle Svensson: comparing sys.maxint to
2**32-1 makes no sense.  Use 2**31-1 instead.
2003-11-29 23:55:09 +00:00
Guido van Rossum 6c9e130524 - Removed FutureWarnings related to hex/oct literals and conversions
and left shifts.  (Thanks to Kalle Svensson for SF patch 849227.)
  This addresses most of the remaining semantic changes promised by
  PEP 237, except for repr() of a long, which still shows the trailing
  'L'.  The PEP appears to promise warnings for operations that
  changed semantics compared to Python 2.3, but this is not
  implemented; we've suffered through enough warnings related to
  hex/oct literals and I think it's best to be silent now.
2003-11-29 23:52:13 +00:00
Raymond Hettinger 37e136373e Make sure the list.sort's decorate step unwinds itself before returning
an exception raised by the key function.
(Suggested by Michael Hudson.)
2003-11-28 21:43:02 +00:00
Thomas Heller b310591169 See SF #848614: distutils' msvccompiler now tries to detect that MSVC6
is installed but the registry settings are incomplete because the gui
has never been run.

Already backported to release23-maint.
2003-11-28 19:42:56 +00:00
Jack Jansen b68947ef97 2.4a0 Package Manager shouldn't attempt to use the 2.3 database.
Things will definitely change before 2.4, but for now use a slightly
different URL.
2003-11-27 22:55:39 +00:00
Raymond Hettinger 4f8f976576 Add optional fillchar argument to ljust(), rjust(), and center() string methods. 2003-11-26 08:21:35 +00:00
Kurt B. Kaiser 188e25f637 Fix a typo introduced at 1.21
M IOBinding.py

Backported to 23-maint
2003-11-25 05:01:00 +00:00
Kurt B. Kaiser 2303b1c19a Keybindings with the Shift modifier now work correctly. So do bindings
which use the Space key.  Limit unmodified user keybindings to the
function keys.
Python Bug 775353, IDLEfork Bugs 755647, 761557

Improve error handling during startup if there's no Tkinter.

M NEWS.txt
M PyShell.py
M config-keys.def
M configHandler.py
M keybindingDialog.py

Backport candidate.
2003-11-24 05:26:16 +00:00
Kurt B. Kaiser c714d45bf5 Update NEWS.txt to include some items missed earlier. Update the
IDLE version to 1.1a0.
Modified Files:
	NEWS.txt idlever.py
2003-11-24 03:23:16 +00:00
Raymond Hettinger f5f41bf087 * Checkin remaining documentation
* Add more tests
* Refactor and neaten the code a bit.
* Rename union_update() to update().
* Improve the algorithms (making them a closer to sets.py).
2003-11-24 02:57:33 +00:00
Barry Warsaw ceca5d2924 test_guess_all_types(): Use a more robust test for checking that
guess_all_extensions() returns (at least) what we expect.  As Jeff
Epler suggests in

http://mail.python.org/pipermail/python-dev/2003-September/038264.html

We use a set to test the results.  This fixes the test when
test_urllib2 is run before test_mimetypes.
2003-11-23 16:21:55 +00:00
Raymond Hettinger 49ba4c39c4 * Simplify hash function and add test to show effectiveness of the hash
function.

* Add a better test for deepcopying.

* Add tests to show the __init__() function works like it does for list
  and tuple.  Add related test.

* Have shallow copies of frozensets return self.  Add related test.

* Have frozenset(f) return f if f is already a frozenset. Add related test.

* Beefed-up some existing tests.
2003-11-23 02:49:05 +00:00
Raymond Hettinger bfd334a42d Extend temporary hashability to remove() and discard().
Brings the functionality back in line with sets.py.
2003-11-22 03:55:23 +00:00
Raymond Hettinger 19c2d77842 Allow temporary hashability for the __contains__ test.
(Requested by Alex Martelli.)
2003-11-21 18:36:54 +00:00
Raymond Hettinger 3fbec701ca issubset() and issuperset() to work with general iterables 2003-11-21 07:56:36 +00:00
Guido van Rossum 944a6c32d7 test_applesingle is an expected skip almost anywhere. 2003-11-20 22:11:29 +00:00
Tim Peters 403a203223 SF bug 839548: Bug in type's GC handling causes segfaults.
Also SF patch 843455.

This is a critical bugfix.
I'll backport to 2.3 maint, but not beyond that.  The bugs this fixes
have been there since weakrefs were introduced.
2003-11-20 21:21:46 +00:00
Raymond Hettinger 901dc98316 test_applesingle is an expected skip on Win32 2003-11-20 19:02:02 +00:00
Walter Dörwald 4df306879b Fix typo fix. 2003-11-20 13:38:01 +00:00
Martin v. Löwis af7dc8d8b8 Patch #831747: Add skip_accept_encoding parameter to putrequest. 2003-11-19 19:51:55 +00:00
Jack Jansen 10d176f77e Get rid of MacOS9 support. Paths are still hard-coded, that'll be fixed
later.
2003-11-19 16:12:08 +00:00
Raymond Hettinger 70b9f499a3 Remove deprecation of sets.Set.update(). 2003-11-19 15:52:14 +00:00
Walter Dörwald fb4d0e0cea Fix typos. 2003-11-19 13:35:49 +00:00
Kurt B. Kaiser 924f616421 - After an exception, run.py was not setting the exception vector. Noam
Raphael suggested correcting this so pdb's postmortem pm() would work.
  IDLEfork Patch 844675

Modified: NEWS.txt  run.py
2003-11-19 04:52:32 +00:00
Barry Warsaw b03136ad52 __init__(): The docstring was incorrect regarding how header wrapping
gets done when maxheaderlen <> 0.  The header really gets wrapped via
the email.Header.Header class, which has a more sophisticated
algorithm than just splitting on semi-colons.
2003-11-19 02:23:01 +00:00
Jack Jansen 3997f58a0c Modified version by Bob Ippolito. It passes the just-added test_applesingle
after some minor mods. Fixes #803498, but should NOT be backported because
the original problem seems to be unreproducable.
2003-11-18 23:09:19 +00:00
Just van Rossum 5949854200 Fix for [ 765456 ]: testAFakeZlib failed on platforms that use a
statically linked zlib module, but since the problem it tests can't
exist on these systems, simply skip it then. Will backport.
2003-11-18 23:00:55 +00:00
Jack Jansen c0b2b72702 Test the applesingle decoder. 2003-11-18 22:36:12 +00:00
Raymond Hettinger 50a4bb325c Various fixups (most suggested by Armin Rigo). 2003-11-17 16:42:33 +00:00
Raymond Hettinger a690a9967e * Migrate set() and frozenset() from the sandbox.
* Install the unittests, docs, newsitem, include file, and makefile update.
* Exercise the new functions whereever sets.py was being used.

Includes the docs for libfuncs.tex.  Separate docs for the types are
forthcoming.
2003-11-16 16:17:49 +00:00
Thomas Heller aaf1c8dc9e SF #841977 - modulefinder fails to find extension modules in packages
The find_all_submodules() method in modulefinder only
looks for *.py, *.pyc, and *.pyo files.  Python
extension modules are only found if they are referenced
in import statements somewhere.

This patch uses the actual list from imp.get_suffixes().

Backported myself.
2003-11-14 10:28:42 +00:00
Tim Peters f7f9e9966b subtype_dealloc(): A more complete fix for critical bug 840829 +
expanded the test case with a piece that needs the more-complete fix.

I'll backport this to 2.3 maint.
2003-11-13 21:59:32 +00:00
Martin v. Löwis d4e48b7f61 Patch #839877: Remove unused lambda expression. 2003-11-13 07:45:39 +00:00
Tim Peters add09b4149 SF bug 840829: weakref callbacks and gc corrupt memory.
subtype_dealloc():  This left the dying object exposed to gc, so that
if cyclic gc triggered during the weakref callback, gc tried to delete
the dying object a second time.  That's a disaster.  subtype_dealloc()
had a (I hope!) unique problem here, as every normal dealloc routine
untracks the object (from gc) before fiddling with weakrefs etc.  But
subtype_dealloc has obscure technical reasons for re-registering the
dying object with gc (already explained in a large comment block at
the bottom of the function).

The fix amounts to simply refraining from reregistering the dying object
with gc until after the weakref callback (if any) has been called.

This is a critical bug (hard to predict, and causes seemingly random
memory corruption when it occurs).  I'll backport it to 2.3 later.
2003-11-12 20:43:28 +00:00
Raymond Hettinger 859db26729 Improve backwards compatibility code to handle True/False. 2003-11-12 15:21:20 +00:00
Raymond Hettinger ad983e79d6 Improve the implementation of itertools.tee().
Formerly, underlying queue was implemented in terms of two lists.  The
new queue is a series of singly-linked fixed length lists.

The new implementation runs much faster, supports multi-way tees, and
allows tees of tees without additional memory costs.

The root ideas for this structure were contributed by Andrew Koenig
and Guido van Rossum.
2003-11-12 14:32:26 +00:00
Neil Schemenauer 767126d7b9 Make Message.__str__ more efficient. 2003-11-11 19:39:17 +00:00
Martin v. Löwis d8921379e9 Patch #798297: Add IMAP THREAD command. 2003-11-10 06:44:44 +00:00
Guido van Rossum b256159396 mktemp() shouldn't rely on os.path.exists(), which can return False if
the file is a symlink.  Instead, use os.lstat directly, if it exists;
fall back on os.stat or the built-in open.  Thanks to Iustin Pop.
2003-11-10 02:16:36 +00:00
Alex Martelli f09994e527 fixed wrong error checking on fcntl call as per SF bug # 821896
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:44:09 +00:00
Alex Martelli 0c5b4ad8f2 fixed obvious bug in _send_header as per SF bug #831271
(same as commit of Sun Nov 2 to the release23-maint branch)
2003-11-09 16:41:38 +00:00
Raymond Hettinger af28e4b66b Update test to handle list.__reversed__(). 2003-11-08 12:39:53 +00:00
Raymond Hettinger e21f606657 SF bug #835457: Small typo in logging documentation 2003-11-08 11:40:03 +00:00
Raymond Hettinger b3af1813eb Convert heapq.py to a C implementation. 2003-11-08 10:24:38 +00:00
Martin v. Löwis d2171d2ba4 Overallocate target buffer for normalization more early. Fixes #834676.
Backported to 2.3.
2003-11-06 20:47:57 +00:00
Raymond Hettinger 85c20a41df Implement and apply PEP 322, reverse iteration 2003-11-06 14:06:48 +00:00
Neil Schemenauer f607fc5395 Add traceback.format_exc(). 2003-11-05 23:03:00 +00:00
Gregory P. Smith a703a21b48 * Use weakref's of DBCursor objects for the iterator cursors to avoid a
memory leak that would've occurred for all iterators that were
  destroyed before having iterated until they raised StopIteration.

* Simplify some code.

* Add new test cases to check for the memleak and ensure that mixing
  iteration with modification of the values for existing keys works.
2003-11-03 01:04:41 +00:00
Raymond Hettinger cc523fc53d SF patch #834015: Remove imports of unused modules
(Contributed by George Yoshida.)
2003-11-02 09:47:05 +00:00
Gregory P. Smith dc113a8a06 * Fix the singlethreaded deadlocks occurring in the simple bsddb interface.
* Add support for multiple iterator/generator objects at once on the simple
  bsddb _DBWithCursor interface.
2003-11-02 09:10:16 +00:00
Martin v. Löwis 893ffa4372 Patch #830858: Correct the number of is-functions. Backported to 2.3 and 2.2. 2003-10-31 15:35:53 +00:00
Martin v. Löwis 45394c281d Patch #531629: Add multicall support. 2003-10-31 13:49:36 +00:00
Martin v. Löwis f9b08b8e60 Patch #785689: Use basename in usage. Backported to 2.3. 2003-10-31 13:05:21 +00:00
Martin v. Löwis 48440b7c27 Patch #: Add POP3 over SSL support. 2003-10-31 12:52:35 +00:00
Raymond Hettinger c40b7afee2 Update test to include "sorted" in dir(list). 2003-10-29 07:23:57 +00:00
Raymond Hettinger 0a9b9da0c3 Add list.sorted() classmethod. 2003-10-29 06:54:43 +00:00
Neal Norwitz 9920430107 SF #775057, fix IDLE problem in about dialog
If the file doesn't exist, the code to display an error message was broken
Will backport.
2003-10-28 21:57:10 +00:00
Armin Rigo 9c8f7eafca Fixed dis.disassemble_string().
Added dis.findlinestarts().
SF bug 811294
2003-10-28 12:17:25 +00:00
Armin Rigo 2b3eb4062c Deleting cyclic object comparison.
SF patch 825639
http://mail.python.org/pipermail/python-dev/2003-October/039445.html
2003-10-28 12:05:48 +00:00
Andrew M. Kuchling 0f10343410 Docstring fix: XHTML 1.0 entities are supported 2003-10-27 15:47:48 +00:00
Martin v. Löwis 11892ecd6d Patch #817854: Add missing operations for SSLFile. Fixes #792101.
Backported to 2.3.
2003-10-27 14:07:53 +00:00
Steve Purcell cca3491dbe Another instance of the same typo. 2003-10-26 16:38:16 +00:00
Raymond Hettinger d591f666de Replace the window() example with pairwise() which demonstrates tee(). 2003-10-26 15:34:50 +00:00
Raymond Hettinger f0c5aec85f Minor improvements to itertools.tee():
* tee object is no longer subclassable
* independent iterators renamed to "itertools.tee_iterator"
* fixed doc string typo and added entry in the module doc string
2003-10-26 14:25:56 +00:00
Steve Purcell 397b45d4ba Incorporated patch 819077, from George Yoshida:
* Fixed typo in docstring for 'failUnlessAlmostEqual()'

* Removed unnecessary use of 'float()' for time values.

* Removed apparently unnecessary import of unittest. At some point in
  the distant past I believe it was necessary otherwise the 'TestCase'
  that a module saw was not the same as the 'TestCase' seen within
  'unittest', and the user's TestCase subclasses were not recognised as
  subclasses of the TestCase seen within unittest. Seems not to be
  necessary now.
2003-10-26 10:41:03 +00:00
Martin v. Löwis 23b44a39ce Patch #812378: Normalize white space. 2003-10-24 20:09:23 +00:00
Andrew M. Kuchling 10a444965d [Bug #822668] tarfile raises an exception if the tarfile is gzipped and is too large; the gzip filesize should be written out mod 2**32. (Reported by Johan Fredrik Ohman) 2003-10-24 17:38:34 +00:00
Armin Rigo 1b3c04b510 Fixed bug introduced in revision 1.27 2003-10-24 17:15:29 +00:00
Walter Dörwald 4894c30626 Fix a bug in the memory reallocation code of PyUnicode_TranslateCharmap().
charmaptranslate_makespace() allocated more memory than required for the
next replacement but didn't remember that fact, so memory size was growing
exponentially every time a replacement string is longer that one character.
This fixes SF bug #828737.
2003-10-24 14:25:28 +00:00
Raymond Hettinger 6a5b027742 Added itertools.tee()
It works like the pure python verion except:
* it stops storing data after of the iterators gets deallocated
* the data queue is implemented with two stacks instead of one dictionary.
2003-10-24 08:45:23 +00:00
Martin v. Löwis d4210bc718 Patch #813200: Quote executable path on Windows. Fixes #811082.
Backported to 2.3.
2003-10-23 15:55:28 +00:00
Guido van Rossum 38443c1513 Remove unneeded import. 2003-10-22 17:22:18 +00:00
Raymond Hettinger 97aa32b467 Replace a reduce() with sum(). 2003-10-22 16:49:01 +00:00
Andrew M. Kuchling 7cebbf39a9 Add docstring 2003-10-22 14:38:54 +00:00
Andrew M. Kuchling 6c2871e707 [Part of patch #648322] Delete the poll2() function, which uses a 'poll' extension module that was once part of Medusa. Contributed by Kjetil Jacobsen 2003-10-22 14:38:27 +00:00
Andrew M. Kuchling f9ca409292 [Bug #758241] When you use asyncore with a non-default map, methods
of the dispatcher object break.  e.g. if you close() the object, it
  tries to remove itself from the default map, not from the map the
  dispatcher was created with.

  The patch, from Stephane Ninin, records the map as an attribute of
  the dispatcher instance.

2.3 bugfix candidate.
2003-10-22 13:48:27 +00:00
Jeremy Hylton fcefd0d2a5 Apply patch 823328 -- support for rfc 2617 digestion authentication.
The patch was tweaked slightly.  It's get a different mechanism for
generating the cnonce which uses /dev/urandom when possible to
generate less-easily-guessed random input.

Also rearrange the imports so that they are alphabetical and
duplicates are eliminated.

Add a few XXX comments about things left undone and things that could
be improved.
2003-10-21 18:07:07 +00:00
Fred Drake 8c4da53afe Make both items() methods return lists; one had changed to return an
iterator where it probably shouldn't have.
Closes SF bug #818861.
2003-10-21 16:45:00 +00:00
Guido van Rossum 571720811b Show microseconds, milliseconds or seconds, whichever is most natural,
rather than showing weird numbers like 8.4e+03 usec.
2003-10-20 23:38:28 +00:00
Walter Dörwald f0dfc7ac5c Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
2003-10-20 14:01:56 +00:00
Martin v. Löwis 9e62ff287b Patch #822994: Consolidate tests for self.closed. 2003-10-18 10:20:42 +00:00
Gustavo Niemeyer ad3fc44ccb Implemented non-recursive SRE matching. 2003-10-17 22:13:16 +00:00
Raymond Hettinger 6b59f5f3fd Let library modules use the new keyword arguments for list.sort(). 2003-10-16 05:53:16 +00:00
Raymond Hettinger 42b1ba31af * list.sort() now supports three keyword arguments: cmp, key, and reverse.
key provides C support for the decorate-sort-undecorate pattern.
  reverse provide a stable sort of the list with the comparisions reversed.

* Amended the docs to guarantee sort stability.
2003-10-16 03:41:09 +00:00
Jeremy Hylton d0e2705f3f Open results files, which contain binary pickles, in binary mode.
Remove fallback code that tries to read marshal data from a results
file, since this module never writes marshal data.
2003-10-14 20:12:06 +00:00
Brett Cannon 2bfb94c871 Add test__locale to expected skip list for Darwin. 2003-10-13 04:27:47 +00:00
Martin v. Löwis d662548c72 Patch #810914: Return absolute path for mkstemp. Fixes #810408.
This should not be backported to 2.3, as it might break backwards
compatibility.
2003-10-12 17:37:01 +00:00
Raymond Hettinger 411c602349 Minor fixup. "Random" was listed twice in __all__. 2003-10-12 17:14:11 +00:00
Brett Cannon 8da2a52dd6 See rev. 1.42 for log message 2003-10-12 04:29:10 +00:00
Brett Cannon 82860df417 see rev. 1.13 for log message 2003-10-12 04:29:10 +00:00
Guido van Rossum 80bd5ca722 Ouch. Remove debug code containing obscenities. :-) 2003-10-10 23:05:41 +00:00
Guido van Rossum b427c00376 The fullmodname() function chopped off the first character if the
module existed in the current directory.  Fix this.  Backport
candidate (I presume).
2003-10-10 23:02:01 +00:00
Barry Warsaw b97f0b7654 TCPServer: Fixed typo in class docstring. 2003-10-09 23:48:52 +00:00
Barry Warsaw 3aaad5079b TCPServer: Fixed typo in class docstring.
Backport candidate.
2003-10-09 22:44:05 +00:00
Martin v. Löwis f563c8bbac Patch #817329: Use SC_OPEN_MAX to determine MAXFD. Backported to 2.3. 2003-10-06 21:34:33 +00:00
Jeremy Hylton 0a4a50dd85 SF patch [ 816787 ] urllib2.URLError don't calll IOError.__init__
Not sure if this fix is great, but it's probably a small improvement.
2003-10-06 05:15:13 +00:00
Jeremy Hylton 504de6bd2c Fix for SF bug [ 817156 ] invalid \U escape gives 0=length unistr. 2003-10-06 05:08:26 +00:00
Raymond Hettinger dbe3d280e7 Adopt Christian Stork's suggested argument order for the logic quantifiers.
Adopt Jeremy Fincher's suggested function name, "any", instead of "some".
2003-10-05 16:47:36 +00:00
Raymond Hettinger 2f726e9093 SF bug #812202: randint is always even
* Added C coded getrandbits(k) method that runs in linear time.
* Call the new method from randrange() for ranges >= 2**53.
* Adds a warning for generators not defining getrandbits() whenever they
  have a call to randrange() with too large of a population.
2003-10-05 09:09:15 +00:00
Barry Warsaw b8c787606c GNUTranslations._parse(): Initialize local variable k so that if the
first line of a header section isn't an RFC-ish header, it's just
ignored instead of throwing an UnboundLocalError.

Backport candidate.
2003-10-04 02:28:31 +00:00
Skip Montanaro 0b87444b1b tweak the docstring to not be so focused on 1.6. 2003-10-03 14:05:26 +00:00
Skip Montanaro dffeed3ffa Make the fieldnames argument optional in the DictReader. If self.fieldnames
is None, the next row read is used as the fieldnames.  In the common case,
this means the programmer doesn't need to know the fieldnames ahead of time.
The first row of the file will be used.  In the uncommon case, this means
the programmer can set the reader's fieldnames attribute to None at any time
and have the next row read as the next set of fieldnames, so a csv file can
contain several "sections", each with different fieldnames.
2003-10-03 14:03:01 +00:00
Gregory P. Smith be0db8b125 bsddb3 4.2.2, adds DBCursor.get_current_size() method to return the length
of the current value without reading the value itself.
2003-10-01 06:48:51 +00:00
Steve Purcell 3a01b7d66e Removed redundant 'return' statement. (Issue 813159) 2003-09-30 09:25:32 +00:00
Gregory P. Smith 1eb41e22ab Use a threadsafe private DBEnv for each bsddb compatibility interface
db that is opened.  DB_THREAD and DB_INIT_LOCK allow for multithreaded
access.  DB_PRIVATE prevents the DBEnv from using the filesystem
(making it only usable by this process; and in this implementation
using one DBEnv per bsddb database)
2003-09-27 23:00:19 +00:00
Raymond Hettinger 9edae346dd Fix typo in the comments. 2003-09-24 03:57:36 +00:00
Raymond Hettinger 3778f40389 Add more identity tests. 2003-09-24 03:56:07 +00:00
Thomas Heller 84ef153c74 Let IDLE use the HTMLHelp docs on Windows, if found.
Already 'backported' to release23-maint.
2003-09-23 20:53:10 +00:00
Raymond Hettinger 9a80c5dbc4 Added codec for bz2 compression. 2003-09-23 20:21:01 +00:00
Steve Purcell 3198275ace Topical change: use 'startswith()' to identify test methods with a
given prefix rather than comparing a slice.
2003-09-23 08:41:53 +00:00
Tim Peters b8b60ea0c9 PlaySoundTest.test_alias_nofallback(): Simplified the coding by using
assertRaises.

NOT a bugfix candidate.
2003-09-22 18:41:53 +00:00
Tim Peters 086e56205c PlaySoundTest.test_alias_fallback(): Disabled this test, and explained
why in a new comment.  My home Win98SE box is one of the "real systems"
alluded to (my system "default sound" appears to have vanished sometime
in the last month, that's certainly not a Python bug, and the MS
PlaySound docs are correct in their explanation of what happens then).

Bugfix candidate.  If someone can still sneak it into 2.3.1, that would
be good.
2003-09-22 18:38:53 +00:00
Walter Dörwald e46d14cd2c Avoid list as a variable name. 2003-09-22 12:43:16 +00:00
Steve Purcell 7e74384af5 - Fixed loading of tests by name when name refers to unbound
method (PyUnit issue 563882, thanks to Alexandre Fayolle)
- Ignore non-callable attributes of classes when searching for test
  method names (PyUnit issue 769338, thanks to Seth Falcon)
- New assertTrue and assertFalse aliases for comfort of JUnit users
- Automatically discover 'runTest()' test methods (PyUnit issue 469444,
  thanks to Roeland Rengelink)
- Dropped Python 1.5.2 compatibility, merged appropriate shortcuts from
  Python CVS; should work with Python >= 2.1.
- Removed all references to string module by using string methods instead
2003-09-22 11:08:12 +00:00
Raymond Hettinger 175a6ac114 Improve and expand identity tests. 2003-09-21 08:14:11 +00:00
Gregory P. Smith 41631e8f66 Adds basic support for BerkeleyDB 4.2.x. Compiles and passes tests; new
features in BerkeleyDB not exposed.  notably: the DB_MPOOLFILE interface
has not yet been wrapped in an object.

Adds support for building and installing bsddb3 in python2.3 that has
an older version of this module installed as bsddb without conflicts.
The pybsddb.sf.net build/packaged version of the module uses a
dynamicly loadable module called _pybsddb rather than _bsddb.
2003-09-21 00:08:14 +00:00
Gregory P. Smith cec1b3f6a7 Maintain backwards compatibility with python < 2.3 by dynamically
adding the iterator interface for python >= 2.3.
2003-09-20 23:51:34 +00:00
Tim Peters 0aab002057 SF patch 809915: Fix bogus address to hopefully always break.
test_bad_address():  Recover from that VeriSign thought it would boost
its corporate coffers to start resolving http://www.sadflkjsasadf.com/.

Bugfix candidate -- although the bug is more VeriSign's than Python's!
2003-09-20 22:16:26 +00:00
Tim Peters c7c516aa51 test__locale (two underscores) can't pass on Windows: RADIXCHAR doesn't
exist, and neither do any of the specific 5-letter locale names the test
is looking for.
2003-09-20 22:06:13 +00:00
Martin v. Löwis c6bb6c0f8c Patch #707167: Pass dircache exceptions to the caller. Fixes #682813.
Not backported because of behaviour change.
2003-09-20 15:52:21 +00:00
Martin v. Löwis 7bdc484c97 Patch #808362: Fix typos. 2003-09-20 11:09:28 +00:00
Martin v. Löwis dc14ab13c4 Patch #793559: Reset __starttext_tag. Fixes #709491. Backported to 2.3. 2003-09-20 10:58:38 +00:00
Martin v. Löwis cb3062e3c0 Patch #805976: Add DOTBOX and UNDERLINE. 2003-09-20 10:52:56 +00:00
Raymond Hettinger 7a70ea4135 SF patch #806246: use basestring where possible
(Contributed by George Yoshida.)
2003-09-17 05:50:59 +00:00
Raymond Hettinger 2d72b5d707 Test __all__ for unittest.py 2003-09-16 04:37:39 +00:00
Steve Purcell d75e7e4342 Explicitly define public symbols via __all__: see discussion with Raymond
Hettinger in comments for issue 804115
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=804115&group_id=5470
2003-09-15 11:01:21 +00:00
Raymond Hettinger d55111f791 * Converted test to unittest format.
* Expanded coverage.
2003-09-13 05:51:09 +00:00
Raymond Hettinger 2e9da6020e The previous change works much faster (one lookup per key) when
iteritems() is defined.
2003-09-13 03:18:34 +00:00
Raymond Hettinger 91dd19db6f SF bug #804115: bad argument handling(unittest.py) 2003-09-13 02:58:00 +00:00
Raymond Hettinger 42a61ed277 Simplify doctest of tee(). 2003-09-13 01:01:34 +00:00
Martin v. Löwis cbe81f2a72 Patch #793021: Implement htmllib.HTMLParser.reset. Fixes #711632.
Backported to 2.3.
2003-09-12 16:38:00 +00:00
Martin v. Löwis 1b699a5f00 Patch #790000: Allow os.access to handle Unicode file name. 2003-09-12 16:25:38 +00:00
Raymond Hettinger deadbf50e4 SF #662923
Add support for the iterator and mapping protocols.
For Py2.3, this was done for shelve, dumbdbm and other mapping objects, but
not for bsddb and dbhash which were inadvertently missed.
2003-09-12 06:33:37 +00:00
Jeremy Hylton b7b1db9191 Oops. Really fix the indentation problem this time. 2003-09-10 20:19:54 +00:00
Jeremy Hylton d7fb676023 Fix inconsistent mix of tabs and spaces that caused test to fail. 2003-09-10 19:57:31 +00:00
Skip Montanaro 4997a69fe4 display link to module docs when it looks like the object module is a core
module
2003-09-10 16:47:51 +00:00
Kurt B. Kaiser 62685d36aa Python Bug 775061
1. Remove "idle" script, it lives in Tools/scripts/ now.
2. Remove shebang from idle.py, should be called explicitly.
3. Remove obsolete test code from rpc.py; needs unit test.
2003-09-10 02:42:18 +00:00
Raymond Hettinger a098b33c93 Add an example to address a common question of how to split iterators. 2003-09-08 23:58:40 +00:00
Raymond Hettinger 9d50d91e77 Set the warnings stacklevel to two. 2003-09-08 19:16:36 +00:00
Tim Peters f1827cfaab SF bug 801631: file.truncate fault on windows.
file_truncate():  C doesn't define what fflush(fp) does if fp is open
for update, and the preceding I/O operation on fp was input.  On Windows,
fflush() actually changes the current file position then.  Because
Windows doesn't support ftruncate() directly, this not only caused
Python's file.truncate() to change the file position (contra our docs),
it also caused the file not to change size.

Repaired by getting the initial file position at the start, restoring
it at the end, and tossing all the complicated micro-efficiency checks
trying to avoid "provably unnecessary" seeks.  file.truncate() can't
be a frequent operation, and seeking to the current file position has
got to be cheap anyway.

Bugfix candidate.
2003-09-07 03:30:18 +00:00
Skip Montanaro 3f7a94824e **kwds arg was missing from __init__ for Dict{Reader,Writer} classes.
will backport.
2003-09-06 19:52:12 +00:00
Raymond Hettinger 66d09f1b30 SF bug #801342: Bug (documentation or real, your choice) in random.sample.
random.sample() uses one of two algorithms depending on the ratio of the
sample size to the population size.  One of the algorithms accepted any
iterable population argument so long as it defined __len__().  The other
had a stronger requirement that the population argument be indexable.

While it met the documentation specifications which insisted that the
population argument be a sequence, it made random.sample() less usable
with sets.  So, the second algorithm was modified to coerce non-indexable
iterables and dictionaries into a tuple before proceeding.
2003-09-06 04:25:54 +00:00