Commit Graph

11339 Commits

Author SHA1 Message Date
Tim Peters 520d8ddd97 Whitespace normalization.
Since test_file is implicated in mysterious test failures
when followed by test_optparse, if I had any brains I'd
look at the checkin that last changed test_file ;-)
2006-06-09 02:11:02 +00:00
Brett Cannon de3b052216 Buffer objects would return the read or write buffer for a wrapped object when
the char buffer was requested.  Now it actually returns the char buffer if
available or raises a TypeError if it isn't (as is raised for the other buffer
types if they are not present but requested).

Not a backport candidate since it does change semantics of the buffer object
(although it could be argued this is enough of a bug to bother backporting).
2006-06-08 17:00:45 +00:00
Georg Brandl 442b49e938 Convert test_file to unittest. 2006-06-08 14:50:53 +00:00
Nick Coghlan 676725db92 Add functools.update_wrapper() and functools.wraps() as described in PEP 356 2006-06-08 13:54:49 +00:00
Armin Rigo fd01d7933b (arre, arigo) SF bug #1350060
Give a consistent behavior for comparison and hashing of method objects
(both user- and built-in methods).  Now compares the 'self' recursively.
The hash was already asking for the hash of 'self'.
2006-06-08 10:56:24 +00:00
Gregory P. Smith 996710fd44 pasted set_lk_detect line in wrong spot in previous commit. fixed. passes tests this time. 2006-06-08 05:39:54 +00:00
Gregory P. Smith dda291c079 * Turn the deadlock situation described in SF bug #775414 into a
DBDeadLockError exception.
* add the test case for my previous dbtables commit.
2006-06-08 05:38:11 +00:00
Gregory P. Smith ff7d991a07 - bsddb: the bsddb.dbtables Modify method now raises the proper error and
aborts the db transaction safely when a modifier callback fails.
  Fixes SF python patch/bug #1408584.

Also cleans up the bsddb.dbtables docstrings since thats the only
documentation that exists for that unadvertised module.  (people
really should really just use sqlite3)
2006-06-08 05:17:08 +00:00
Ronald Oussoren 4b7a6c8b58 * If BuildApplet.py is used as an applet it starts with a version of
sys.exutable that isn't usuable on an #!-line. That results in generated
  applets that don't actually work. Work around this problem by resetting
  sys.executable.
* argvemulator.py didn't work on intel macs. This patch fixes this
  (bug #1491468)
2006-06-07 20:18:44 +00:00
Tim Peters 80dc76e907 SF patch 1501987: Remove randomness from test_exceptions,
from ?iga Seilnacht (sorry about the name, but Firefox
on my box can't display the first character of the name --
the SF "Unix name" is zseil).

This appears to cure the oddball intermittent leaks across
runs when running test_exceptions under -R.  I'm not sure
why, but I'm too sleepy to care ;-)

The thrust of the SF patch was to remove randomness in the
pickle protocol used.  I changed the patch to use
range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and
cPickle, and randomly mucked with other test lines to put
statements on their own lines.

Not a bugfix candidate (this is fiddling new-in-2.5 code).
2006-06-07 06:57:51 +00:00
Tim Peters c27d655c00 dash_R_cleanup(): Clear filecmp._cache. This accounts for
different results across -R runs (at least on Windows) of
test_filecmp.
2006-06-07 01:04:59 +00:00
Thomas Heller 56dab85022 Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures 2006-06-06 15:34:18 +00:00
Martin Blais 215f13dd11 Normalized a few cases of whitespace in function declarations.
Found them using::

  find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done
  find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done

(I was doing this all over my own code anyway, because I'd been using spaces in
all defs, so I thought I'd make a run on the Python code as well.  If you need
to do such fixes in your own code, you can use xx-rename or parenregu.el within
emacs.)
2006-06-06 12:46:55 +00:00
Thomas Heller ecc3e67b98 Convert CFieldObject tp_members to tp_getset, since there is no
structmember typecode for Py_ssize_t fields.  This should fix some of
the errors on the PPC64 debian machine (64-bit, big endian).

Assigning to readonly fields now raises AttributeError instead of
TypeError, so the testcase has to be changed as well.
2006-06-06 11:34:33 +00:00
Tim Peters c169e9f19c Add missing svn:eol-style property to text files. 2006-06-05 20:49:27 +00:00
Tim Peters 852eae1bc1 Access _struct attributes directly instead of mucking with getattr.
string_reverse():  Simplify.

assertRaises():  Raise TestFailed on failure.

test_unpack_from(), test_pack_into(), test_pack_into_fn():  never
use `assert` to test for an expected result (it doesn't test anything
when Python is run with -O).
2006-06-05 20:48:49 +00:00
Gregory P. Smith 372b583a6b * fix DBCursor.pget() bug with keyword argument names when no data= is
supplied [SF pybsddb bug #1477863]
2006-06-05 18:48:21 +00:00
Tim Peters d6024d30c6 Whitespace normalization. 2006-06-05 18:36:12 +00:00
Gregory P. Smith 9d7a69caa9 forgot to add this file in previous commit 2006-06-05 18:20:07 +00:00
Gregory P. Smith f0547d0d3e * add support for DBSequence objects [patch #1466734] 2006-06-05 17:38:04 +00:00
Gregory P. Smith db8a80735b * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] 2006-06-05 01:56:15 +00:00
Tim Peters 7140de01cf Whitespace normalization. 2006-06-05 01:47:24 +00:00
Tim Peters bf0400abe9 Remove doctest.testmod's deprecated (in 2.4) `isprivate`
argument.  A lot of hair went into supporting that!
2006-06-05 01:43:03 +00:00
Gregory P. Smith 76a82e89ab * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] 2006-06-05 01:39:52 +00:00
Tim Peters 06c5c00819 "Flat is better than nested."
Move the long-winded, multiply-nested -R support out
of runtest() and into some module-level helper functions.
This makes runtest() and the -R code easier to follow.
That in turn allowed seeing some opportunities for code
simplification, and made it obvious that reglog.txt
never got closed.
2006-06-05 00:55:26 +00:00
Gregory P. Smith 3dd20022ac bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present
in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized
char **log_list.

feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2.
2006-06-05 00:31:01 +00:00
Tim Peters 28eeefe566 Revert revisions:
46640 Patch #1454481:  Make thread stack size runtime tunable.
46647 Markup fix

The first is causing many buildbots to fail test runs, and there
are multiple causes with seemingly no immediate prospects for
repairing them.  See python-dev discussion.

Note that a branch can (and should) be created for resolving these
problems, like

svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH

followed by merging rev 46647 to the new branch.
2006-06-04 23:52:47 +00:00
Tim Peters c7d14452a4 Whitespace normalization. 2006-06-04 23:43:53 +00:00
Georg Brandl ad62489e47 Bug #1500293: fix memory leaks in _subprocess module. 2006-06-04 22:15:37 +00:00
Georg Brandl ddbaa660d3 Patch #1346214: correctly optimize away "if 0"-style stmts
(thanks to Neal for review)
2006-06-04 21:56:52 +00:00
Martin v. Löwis 3f767795f6 Patch #1359618: Speed-up charmap encoder. 2006-06-04 19:36:28 +00:00
Ronald Oussoren fb2a169ce3 Drop Mac wrappers for the WASTE library. 2006-06-04 14:24:59 +00:00
Martin Blais af2ae72cb2 Fixes in struct and socket from merge reviews.
- Following Guido's comments, renamed

  * pack_to -> pack_into
  * recv_buf -> recv_into
  * recvfrom_buf -> recvfrom_into

- Made fixes to _struct.c according to Neal Norwitz comments on the checkins
  list.

- Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
2006-06-04 13:49:49 +00:00
Andrew MacIntyre 6539d2d3c7 Patch #1454481: Make thread stack size runtime tunable. 2006-06-04 12:31:09 +00:00
Tim Peters c65a13f53b Whitespace normalization. 2006-06-04 01:22:53 +00:00
Tim Peters d609b1a20e pprint functions used to sort a dict (by key) if and only if
the output required more than one line.  "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__).  None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.

This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
2006-06-02 23:22:51 +00:00
Martin Blais 7f7386cfd2 Fixed struct test to not use unittest. 2006-06-02 13:03:43 +00:00
Neal Norwitz 38d4d4a35b Fix memory leak found by valgrind. 2006-06-02 04:50:49 +00:00
Neal Norwitz e152aab977 Convert docstrings to comments so regrtest -v prints method names 2006-06-02 04:45:53 +00:00
Tim Peters 80a18f0f9c Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results.  The implementations were repaired later during the
sprint, but the new test remained disabled.
2006-06-01 13:56:26 +00:00
Tim Peters 5535da0303 Whitespace normalization. 2006-06-01 13:41:46 +00:00
Armin Rigo 35f6d36951 [ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
2006-06-01 13:19:12 +00:00
Georg Brandl e08940ef6c Some code style tweaks, and remove apply. 2006-06-01 13:00:49 +00:00
Georg Brandl b9120e772b Correctly dispatch Faults in loads (patch #1498627) 2006-06-01 12:30:46 +00:00
Andrew M. Kuchling 622f144175 [Bug #1473048]
SimpleXMLRPCServer and DocXMLRPCServer don't look at
the path of the HTTP request at all; you can POST or
GET from / or /RPC2 or /blahblahblah with the same results.
Security scanners that look for /cgi-bin/phf will therefore report
lots of vulnerabilities.

Fix: add a .rpc_paths attribute to the SimpleXMLRPCServer class,
and report a 404 error if the path isn't on the allowed list.

Possibly-controversial aspect of this change: the default makes only
'/' and '/RPC2' legal.  Maybe this will break people's applications
(though I doubt it).  We could just set the default to an empty tuple,
which would exactly match the current behaviour.
2006-05-31 14:08:48 +00:00
Neal Norwitz 9f16dd026c On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
2006-05-31 09:02:44 +00:00
Tim Peters dd55b0a32c Whitespace normalization. 2006-05-30 23:28:02 +00:00
Fredrik Lundh 9e9ef9fa5a changed count to return 0 for slices outside the source string 2006-05-30 17:39:58 +00:00
Bob Ippolito 4182a75571 Change wrapping terminology to overflow masking 2006-05-30 17:37:54 +00:00
Fredrik Lundh 93eff6fecd changed find/rfind to return -1 for matches outside the source string 2006-05-30 17:11:48 +00:00
Georg Brandl cdcede62c0 Convert test_exceptions to unittest. 2006-05-30 08:47:19 +00:00
Georg Brandl b0432bc032 Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
2006-05-30 08:17:00 +00:00
Georg Brandl 861089fc49 Disallow keyword args for exceptions. 2006-05-30 07:34:45 +00:00
Neal Norwitz 008b861bf0 Don't fail if the (sub)pkgname already exist. 2006-05-30 07:21:10 +00:00
Georg Brandl 05f97bffac Add a test case for exception pickling. args is never NULL. 2006-05-30 07:13:29 +00:00
Tim Peters 27c70598a8 Whitespace normalization. 2006-05-30 02:26:46 +00:00
Tim Peters aba19bc45f deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:

    test_genexps (or any other doctest-based test)
    test_struct
    test_doctest

The `warnings` module needs an advertised way to save/restore
its internal filter list.
2006-05-30 02:25:25 +00:00
Bob Ippolito 6067f20172 Add a length check to aifc to ensure it doesn't write a bogus file 2006-05-30 00:26:01 +00:00
Bob Ippolito 2fd3977a9d struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly) 2006-05-29 22:55:48 +00:00
Fredrik Lundh b51b470eb8 fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
2006-05-29 22:42:07 +00:00
Georg Brandl 261e251df8 Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
2006-05-29 20:52:54 +00:00
Nick Coghlan 08490146df When adding a module like functools, it helps to let SVN know about the file. 2006-05-29 20:27:44 +00:00
Georg Brandl 47dc118247 Fix #1494787 (pyclbr counts whitespace as superclass name) 2006-05-29 14:39:00 +00:00
Nick Coghlan c649ec5b69 Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
2006-05-29 12:43:05 +00:00
Armin Rigo a6123abb72 A clearer error message when passing -R to regrtest.py with
release builds of Python.
2006-05-28 22:07:08 +00:00
Georg Brandl 2b33037611 Patch #1496206: urllib2 PasswordMgr ./. default ports 2006-05-28 20:23:12 +00:00
Armin Rigo a3f092751a ("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.

Remaining open issues:
 * test_extcall is an output test, messy to make robust
 * tarfile.py has a potential bug here, but I'm not familiar
   enough with this code.  Filed in as SF bug #1496501.
 * urllib2.HTTPPasswordMgr() returns a random result if there is more
   than one matching root path.  I'm asking python-dev for
   clarification...
2006-05-28 19:13:17 +00:00
George Yoshida f3c65de460 Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
2006-05-28 16:39:09 +00:00
Tim Peters 4e30617bad The cheery optimism of old age. 2006-05-27 14:13:13 +00:00
Georg Brandl e895318ee2 Always close BZ2Proxy object. Remove unnecessary struct usage. 2006-05-27 14:02:03 +00:00
Tim Peters de41dc865a More random thrashing trying to understand spurious
Windows failures.  Who's keeping a bz2 file open?
2006-05-27 12:36:53 +00:00
Richard Jones 7b9558d37d Conversion of exceptions over from faked-up classes to new-style C types. 2006-05-27 12:29:24 +00:00
Bob Ippolito 1fcdc232db Fix up struct docstrings, add struct.pack_to function for symmetry 2006-05-27 12:11:36 +00:00
Martin v. Löwis d004fc810a Patch 1494554: Update numeric properties to Unicode 4.1. 2006-05-27 08:36:52 +00:00
Bob Ippolito aa70a17e13 enable all of the struct tests, use ssize_t, fix some whitespace 2006-05-26 20:25:23 +00:00
Fredrik Lundh a26de2a80f added rpartition method to UserString class 2006-05-26 19:23:21 +00:00
Fredrik Lundh 9c0e9c089c needspeed: rpartition documentation, tests, and a bug fixes.
feel free to add more tests and improve the documentation.
2006-05-26 18:24:15 +00:00
Georg Brandl f4ef11659c Need for speed: Patch #921466 : sys.path_importer_cache is now used to cache valid and
invalid file paths for the built-in import machinery which leads to
  fewer open calls on startup.

  Also fix issue with PEP 302 style import hooks which lead to more open()
  calls than necessary.
2006-05-26 18:03:31 +00:00
Andrew Dalke 725fe4089d Test for more edge strip cases; leading and trailing separator gets removed
even with strip(..., 0)
2006-05-26 16:22:52 +00:00
Bob Ippolito ad647859f4 Fix distutils so that libffi will cross-compile between darwin/x86 and darwin/ppc 2006-05-26 14:07:23 +00:00
Tim Peters 02494764cb Explicitly close files. I'm trying to stop the frequent spurious test_tarfile
failures on Windows buildbots, but it's hard to know how since the regrtest
failure output is useless here, and it never fails when a buildbot slave runs
test_tarfile the second time in verbose mode.
2006-05-26 14:02:05 +00:00
Tim Peters b1f3251ceb Use open() to open files (was using file()). 2006-05-26 13:39:17 +00:00
Bob Ippolito e27337b5d0 fix #1229380 No struct.pack exception for some out of range integers 2006-05-26 13:15:44 +00:00
Andrew Dalke 669fa188b1 Added more rstrip tests, including for prealloc'ed arrays 2006-05-26 13:05:55 +00:00
Bob Ippolito 910a08f6da quick hack to fix busted binhex test 2006-05-26 12:52:53 +00:00
Andrew Dalke 5cc6009f0d Test cases for off-by-one errors in string split with multicharacter pattern. 2006-05-26 12:31:00 +00:00
Andrew Dalke 005aee2c39 I like tests.
The new split functions use a preallocated list.  Added tests which exceed
the preallocation size, to exercise list appends/resizes.

Also added more edge case tests.
2006-05-26 12:28:15 +00:00
Tim Peters fe98f9613b Whitespace normalization. 2006-05-26 12:26:21 +00:00
Martin Blais 2856e5f390 Support for buffer protocol for socket and struct.
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
  protocol (send and sendto already did).

* Added struct.pack_to(), that is the corresponding buffer compatible method to
  unpack_from().

* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Georg Brandl a172c32c05 Add "partition" to UserString. 2006-05-26 11:26:11 +00:00
Andrew Dalke 03fb444990 Added split whitespace checks for characters other than space. 2006-05-26 11:15:22 +00:00
Andrew Dalke 984b971341 Added a few more test cases for whitespace split. These strings have leading whitespace. 2006-05-26 11:11:38 +00:00
Fredrik Lundh 06a69dd8ff needforspeed: partition implementation, part two.
feel free to improve the documentation and the docstrings.
2006-05-26 08:54:28 +00:00
Ronald Oussoren 19bebf2e2f Without this patch OSX users couldn't add new help sources because the code
tried to update one item in a tuple.
2006-05-26 08:41:25 +00:00
Tim Peters d95d593f47 Whitespace normalization. 2006-05-25 21:52:19 +00:00
Brett Cannon 36850456ca Change test_values so that it compares the lowercasing of group names since getgrall() can return all lowercase names while getgrgid() returns proper casing.
Discovered on Ubuntu 5.04 (custom).
2006-05-25 21:33:11 +00:00
Georg Brandl cfecd599b6 Guard the _active.remove() call to avoid errors when there is no _active list. 2006-05-25 18:44:09 +00:00
Fredrik Lundh 0c71f88fc9 needforspeed: check for overflow in replace (from Andrew Dalke) 2006-05-25 16:46:54 +00:00
Andrew Dalke 2bddcbf10e Added tests for implementation error we came up with in the need for speed sprint. 2006-05-25 16:30:52 +00:00
Thomas Wouters 143bdfcee6 Update graminit.c for the fix for #1488915, Multiple dots in relative import
statement raise SyntaxError, and add testcase.
2006-05-25 11:26:25 +00:00
Tim Peters 696cf43b58 Heavily fiddled variant of patch #1442927: PyLong_FromString optimization.
``long(str, base)`` is now up to 6x faster for non-power-of-2 bases.  The
largest speedup is for inputs with about 1000 decimal digits.  Conversion
from non-power-of-2 bases remains quadratic-time in the number of input
digits (it was and remains linear-time for bases 2, 4, 8, 16 and 32).

Speedups at various lengths for decimal inputs, comparing 2.4.3 with
current trunk.  Note that it's actually a bit slower for 1-digit strings:

  len  speedup
 ----  -------
   1     -4.5%
   2      4.6%
   3      8.3%
   4     12.7%
   5     16.9%
   6     28.6%
   7     35.5%
   8     44.3%
   9     46.6%
  10     55.3%
  11     65.7%
  12     77.7%
  13     73.4%
  14     75.3%
  15     85.2%
  16    103.0%
  17     95.1%
  18    112.8%
  19    117.9%
  20    128.3%
  30    174.5%
  40    209.3%
  50    236.3%
  60    254.3%
  70    262.9%
  80    295.8%
  90    297.3%
 100    324.5%
 200    374.6%
 300    403.1%
 400    391.1%
 500    388.7%
 600    440.6%
 700    468.7%
 800    498.0%
 900    507.2%
1000    501.2%
2000    450.2%
3000    463.2%
4000    452.5%
5000    440.6%
6000    439.6%
7000    424.8%
8000    418.1%
9000    417.7%
2006-05-24 21:10:40 +00:00
Tim Peters f4049089c5 Disable the damn empty-string replace test -- it can't
be make to pass now for unicode if it passes for str, or
vice versa.
2006-05-24 21:00:45 +00:00
Tim Peters f47b1cd839 Whitespace normalization. 2006-05-24 20:29:44 +00:00
Tim Peters beaec0c3a1 We can't leave the checked-in tests broken. 2006-05-24 20:27:18 +00:00
Andrew Dalke e5488ec01e Added a slew of test for string replace, based various corner cases from
the Need For Speed sprint coding.  Includes commented out overflow tests
which will be uncommented once the code is fixed.

This test will break the 8-bit string tests because
    "".replace("", "A") == "" when it should == "A"

We have a fix for it, which should be added tomorrow.
2006-05-24 18:55:37 +00:00
Bob Ippolito eb62127842 refactor unpack, add unpack_from 2006-05-24 15:32:06 +00:00
Tim Peters 211219af4f Whitespace normalization. 2006-05-23 21:54:23 +00:00
Tim Peters 1bddfb84ee test_struct grew weird behavior under regrtest.py -R,
due to a module-level cache.  Clearing the cache should
make it stop showing up in refleak reports.
2006-05-23 21:51:35 +00:00
Bob Ippolito 232f3c91f9 patch #1493701: performance enhancements for struct module 2006-05-23 19:12:41 +00:00
Bob Ippolito 27abce5ba8 revert #1493701 2006-05-23 19:09:51 +00:00
Bob Ippolito fb8b84af54 Patch #1493701: performance enhancements for struct module. 2006-05-23 18:46:41 +00:00
Tim Peters b713ec2531 Bug #1334662 / patch #1335972: int(string, base) wrong answers.
In rare cases of strings specifying true values near sys.maxint,
and oddball bases (not decimal or a power of 2), int(string, base)
could deliver insane answers.  This repairs all such problems, and
also speeds string->int significantly.  On my box, here are %
speedups for decimal strings of various lengths:

length speedup
------ -------
 1       12.4%
 2       15.7%
 3       20.6%
 4       28.1%
 5       33.2%
 6       37.5%
 7       41.9%
 8       46.3%
 9       51.2%
10       19.5%
11       19.9%
12       23.9%
13       23.7%
14       23.3%
15       24.9%
16       25.3%
17       28.3%
18       27.9%
19       35.7%

Note that the difference between 9 and 10 is the difference between
short and long Python ints on a 32-bit box.  The patch doesn't
actually do anything to speed conversion to long:  the speedup is
due to detecting "unsigned long" overflow more quickly.

This is a bugfix candidate, but it's a non-trivial patch and it
would be painful to separate the "bug fix" from the "speed up" parts.
2006-05-23 18:45:30 +00:00
Ronald Oussoren b02daf794b Patch #1488098.
This patchs makes it possible to create a universal build on OSX 10.4 and use
the result to build extensions on 10.3. It also makes it possible to override
the '-arch' and '-isysroot' compiler arguments for specific extensions.
2006-05-23 12:01:11 +00:00
Ronald Oussoren 58f8eba372 Disable linking extensions with -lpython2.5 for darwin. This should fix bug
#1487105.
2006-05-23 11:47:16 +00:00
Bob Ippolito d82c3105cc Apply revised patch for GzipFile.readline performance #1281707 2006-05-22 15:59:12 +00:00
Bob Ippolito b97597316b Revert gzip readline performance patch #1281707 until a more generic performance improvement can be found 2006-05-22 15:22:46 +00:00
Bob Ippolito d72aab5e31 GzipFile.readline performance improvement (~30-40%), patch #1281707 2006-05-22 14:31:24 +00:00
Tim Peters 8a299d25ec Whitespace normalization. 2006-05-19 19:16:34 +00:00
Neal Norwitz 5ef922447c Fix #1474677, non-keyword argument following keyword. 2006-05-19 06:43:50 +00:00
Vinay Sajip 9e9c2528a4 Changed status from "beta" to "production"; since logging has been part of the stdlib since 2.3, it should be safe to make this assertion ;-) 2006-05-18 07:28:58 +00:00
Georg Brandl 7b90e168f3 Bug #1462152: file() now checks more thoroughly for invalid mode
strings and removes a possible "U" before passing the mode to the
C library function.
2006-05-18 07:01:27 +00:00
Neal Norwitz b678ce5aa6 Little cleanup 2006-05-18 06:51:46 +00:00
Georg Brandl fad65594ba Fix test_locale for platforms without a default thousands separator. 2006-05-18 06:33:27 +00:00
Georg Brandl bbab671d7d Remove unused import. 2006-05-18 06:18:06 +00:00
Georg Brandl e4751e3cdc Amendments to patch #1484695. 2006-05-18 06:11:19 +00:00
Tim Peters fd4c419332 Whitespace normalization. 2006-05-18 02:06:40 +00:00
Georg Brandl b89316fdbf Patch #1180296: improve locale string formatting functions 2006-05-17 15:51:16 +00:00
Georg Brandl 9d6da3e2f2 Delay-import some large modules to speed up urllib2 import.
(fixes #1484793).
2006-05-17 15:17:00 +00:00
Georg Brandl e3a25838db Patch #1486962: Several bugs in the turtle Tk demo module were fixed
and several features added, such as speed and geometry control.
2006-05-17 14:56:04 +00:00
Georg Brandl feb0a3bdbc Add global debug flag to cookielib to avoid heavy dependency on the logging module.
Resolves #1484758.
2006-05-17 14:45:06 +00:00
Tim Peters 1b38357094 Text files missing the SVN eol-style property. 2006-05-16 23:24:08 +00:00
Tim Peters cbd7b756e4 Whitespace normalization. 2006-05-16 23:22:20 +00:00
Georg Brandl 8d3342b489 Patch #1435422: zlib's compress and decompress objects now have a
copy() method.
2006-05-16 07:38:27 +00:00
Tim Peters 4ccc0b7dfe test_directory(): Remove the leftover temp directory that's making
the Windows buildbots fail test_tarfile.
2006-05-15 21:32:25 +00:00
Tim Peters 12087bae18 ReadDetectFileobjTest: repair Windows disasters by opening
the file object in binary mode.

The Windows buildbot slaves shouldn't swap themselves to death
anymore.  However, test_tarfile may still fail because of a
temp directory left behind from a previous failing run.
Windows buildbot owners may need to remove that directory
by hand.
2006-05-15 20:44:10 +00:00
Georg Brandl 49c8f4cf36 [ 1488881 ] tarfile.py: support for file-objects and bz2 (cp. #1488634) 2006-05-15 19:30:35 +00:00
Neal Norwitz 373f0a718c - Bug #1487966: Fix SystemError with conditional expression in assignment
Most of the test_syntax changes are just updating the numbers.
2006-05-15 07:04:36 +00:00
Ronald Oussoren 836b039b7c Rework the build system for osx applications:
* Don't use xcodebuild for building PythonLauncher, but use a normal unix
  makefile. This makes it a lot easier to use the same build flags as for the
  rest of python (e.g. make a universal version of python launcher)
* Convert the mac makefile-s to makefile.in-s and use configure to set makefile
  variables instead of forwarding them as command-line arguments
* Add a C version of pythonw, that we you can use '#!/usr/local/bin/pythonw'
* Build IDLE.app using bundlebuilder instead of BuildApplet, that will allow
  easier modification of the bundle contents later on.
2006-05-14 19:56:34 +00:00
Thomas Heller 0e10cb0266 add svn:eol-style native svn:keywords Id 2006-05-12 19:31:46 +00:00
Thomas Heller e43a0fcc9d Add missing svn properties. 2006-05-12 18:16:03 +00:00
Georg Brandl 1fb9f528bd Typo fix. 2006-05-11 19:57:09 +00:00
Tim Peters 0ebf27aad9 BaseThreadedTestCase.setup(): stop special-casing WindowsError.
Rev 45964 fiddled with WindowsError, and broke test_bsddb3 on all
the Windows buildbot slaves as a result.  This should repair it.
2006-05-11 16:37:42 +00:00
Martin v. Löwis 879768dd97 Change WindowsError to carry the Win32 error code in winerror,
and the DOS error code in errno. Revert changes where
WindowsError catch blocks unnecessarily special-case OSError.
2006-05-11 13:28:43 +00:00
Georg Brandl 195648000c Patch #721464: pdb.Pdb instances can now be given explicit stdin and
stdout arguments, making it possible to redirect input and output
for remote debugging.
2006-05-10 17:13:20 +00:00
Georg Brandl 38c6a22f38 Patch #1484695: Update the tarfile module to version 0.8. This fixes
a couple of issues, notably handling of long file names using the
GNU LONGNAME extension.
2006-05-10 16:26:03 +00:00
Tim Peters ad2ef33245 Variant of patch #1478292. doctest.register_optionflag(name)
shouldn't create a new flag when `name` is already the name of
an option flag.
2006-05-10 02:43:01 +00:00
Thomas Heller 40f55b2f08 Disable a test that is unreliable. 2006-05-09 20:20:15 +00:00
Georg Brandl e854e765f4 Patch #1478993: take advantage of BaseException/Exception split in cookielib 2006-05-08 17:48:01 +00:00
Georg Brandl b5f2e5cc50 Patch #1479302: Make urllib2 digest auth and basic auth play together. 2006-05-08 17:36:08 +00:00
Georg Brandl a166a91659 Add test for rev. 45934. 2006-05-08 17:28:47 +00:00
Georg Brandl e58334ae9e Patch #1483395: add new TLDs to cookielib 2006-05-07 20:44:34 +00:00
Martin v. Löwis e93abb7ca6 Handle ERROR_ALREADY_EXISTS. 2006-05-06 20:04:08 +00:00
Martin v. Löwis d4e3bb3d39 Port access, chmod, parts of getcwdu, mkdir, and utime to direct Win32 API. 2006-05-06 16:32:54 +00:00
Thomas Heller 97a7b7fef3 oops - the function is exported as 'my_free', not 'free'. 2006-05-05 18:46:27 +00:00
Thomas Heller 748f6fbf2c Fix memory leaks in the ctypes test suite, reported by valgrind, by
free()ing the memory we allocate.
2006-05-05 18:43:24 +00:00
Martin v. Löwis 08041d582b Update checks to consider Windows error numbers. 2006-05-04 14:27:52 +00:00
Martin v. Löwis 8e0d494e41 Implement os.{chdir,rename,rmdir,remove} using Win32 directly. 2006-05-04 10:08:42 +00:00
Martin v. Löwis 777367103c Patch #1475845: Raise IndentationError for unexpected indent. 2006-05-04 05:51:03 +00:00
Georg Brandl 61d168a55e Bug #1481530: allow "from os.path import ..." with imputil 2006-05-04 05:08:10 +00:00
Thomas Heller 14f3da7585 Don't fail the tests when libglut.so or libgle.so cannot be loaded. 2006-05-03 18:35:39 +00:00
Georg Brandl 1bb6230930 Bug #1385040: don't allow "def foo(a=1, b): pass" in the compiler package. 2006-05-03 18:18:32 +00:00
Georg Brandl 23d9d45482 Bug #1472191: convert breakpoint indices to ints before comparing them to ints 2006-05-03 18:12:33 +00:00
Georg Brandl a2ac2ef44f RFE #1472176: In httplib, don't encode the netloc and hostname with "idna" if not necessary. 2006-05-03 18:03:22 +00:00
Georg Brandl 7377ad2ecd Add seamonkey to list of Windows browsers too. 2006-05-03 17:46:13 +00:00
Nick Coghlan afd5e63e24 Finish bringing SVN into line with latest version of PEP 343 by getting rid of all remaining references to context objects that I could find. Without a __context__() method context objects no longer exist. Also get test_with working again, and adopt a suggestion from Neal for decimal.Context.get_manager() 2006-05-03 13:02:47 +00:00
Georg Brandl 1b06a1d4e3 Move network tests from test_urllib2 to test_urllib2net. 2006-05-03 05:15:10 +00:00
Georg Brandl 852bb00818 Patch #1480067: don't redirect HTTP digest auth in urllib2 2006-05-03 05:05:02 +00:00
Tim Peters 4511a713d5 Whitespace normalization. 2006-05-03 04:46:14 +00:00
Andrew M. Kuchling 214db63df8 Use open() instead of file() 2006-05-02 21:44:33 +00:00
Guido van Rossum b2045837b6 Hopefully this will fix the spurious failures of test_mailbox.py that I'm
experiencing.  (This code and mailbox.py itself are full of calls to file()
that should be calls to open() -- but I'm not fixing those.)
2006-05-02 20:47:36 +00:00
Guido van Rossum da5b701aee Get rid of __context__, per the latest changes to PEP 343 and python-dev
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
2006-05-02 19:47:52 +00:00
Guido van Rossum 8f6cbe1502 Fix the formatting of KeyboardInterrupt -- a bad issubclass() call. 2006-05-02 17:36:09 +00:00
Vinay Sajip 4b4a63e30a Replaced my dumb way of calculating seconds to midnight with Tim Peters' much more sensible suggestion. What was I thinking ?!? 2006-05-02 08:35:36 +00:00
Fred Drake 017e68c413 SF #1479988: add methods to allow access to weakrefs for the
weakref.WeakKeyDictionary and weakref.WeakValueDictionary
2006-05-02 06:53:59 +00:00
Neal Norwitz a6d01cec3f Try to fix breakage caused by patch #1479181, r45850 2006-05-02 06:23:22 +00:00
Neal Norwitz c4edb0ec81 SF #1479181: split open() and file() from being aliases for each other. 2006-05-02 04:43:14 +00:00
Martin v. Löwis a07fbce451 Rename parameters to match the documentation (which
in turn matches Microsoft's documentation).
Drop unused parameter in CAB.append.
2006-05-01 16:14:16 +00:00
Martin v. Löwis 594855c2d3 Rename uisample to text, drop all non-text tables. 2006-05-01 15:56:03 +00:00
Barry Warsaw dbcc8d9b24 Port forward from 2.4 branch:
Patch #1464708 from William McVey: fixed handling of nested comments in mail
addresses.  E.g.

"Foo ((Foo Bar)) <foo@example.com>"

Fixes for both rfc822.py and email package.  This patch needs to be back
ported to Python 2.3 for email 2.5.
2006-05-01 03:03:02 +00:00
Georg Brandl 3583cff5a9 Patch #1472854: make the rlcompleter.Completer class usable on non-
UNIX platforms.
2006-04-30 18:14:54 +00:00
Georg Brandl 208badda27 Fix another problem in inspect: if the module for an object cannot be found, don't try to give its __dict__ to linecache. 2006-04-30 17:42:26 +00:00
Phillip J. Eby 72ae6c80d4 Fix infinite regress when inspecting <string> or <stdin> frames. 2006-04-30 15:59:26 +00:00
Georg Brandl de9b624fb9 Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.
On the way, add a decorator to test_support to facilitate running single
test functions in different locales with automatic cleanup.
2006-04-30 11:13:56 +00:00
Georg Brandl 44a118af50 Patch #1470976: don't NLST files when retrieving over FTP. 2006-04-30 09:23:59 +00:00
Georg Brandl bffb0bc064 In stdlib, use hashlib instead of deprecated md5 and sha modules. 2006-04-30 08:57:35 +00:00
Georg Brandl fa42bd7af4 Patch #1470846: fix urllib2 ProxyBasicAuthHandler. 2006-04-30 07:06:11 +00:00
Brett Cannon 1e01397533 Fix docstring for contextfactory; mentioned old contextmanager name. 2006-04-29 21:29:50 +00:00
Ronald Oussoren 988117fd63 Patch 1471883: --enable-universalsdk on Mac OS X 2006-04-29 11:31:35 +00:00
Georg Brandl 6d78a582ec Bug #1478429: make datetime.datetime.fromtimestamp accept every float,
possibly "rounding up" to the next whole second.
2006-04-28 19:09:24 +00:00
Thomas Heller 6a907d8b8e Remove a duplicated test (the same test is in test_incomplete.py). 2006-04-28 17:02:18 +00:00
Georg Brandl 0f45a078a3 Bug #1478326: don't allow '/' in distutils.util.get_platform machine names
since this value is used to name the build directory.
2006-04-28 16:58:52 +00:00
Georg Brandl 7a3fd89994 Bug #1472949: stringify IOErrors in shutil.copytree when appending
them to the Error errors list.
2006-04-28 16:54:25 +00:00
Georg Brandl 314acacb52 Add SeaMonkey to the list of Mozilla browsers. 2006-04-28 16:31:17 +00:00
Neal Norwitz dd28d1c6c2 Try to really fix the slow buildbots this time.
Printing to stdout, doesn't mean the data was actually written.
It depends on the buffering, so we need to flush.  This will hopefully
really fix the buildbots getting killed due to no output on the slow bots.
2006-04-28 04:34:43 +00:00
Neal Norwitz 0bbbb005c5 Add some whitespace to be more consistent. 2006-04-28 04:32:20 +00:00
Thomas Wouters 076ba2129b Add more ignores of ImportWarnings; these are all just potential triggers
(since they won't trigger if zlib is already sucessfully imported); they
were found by grepping .py files, instead of looking at warning output :)
2006-04-27 23:41:27 +00:00
Thomas Wouters 9df4e6f673 - Add new Warning class, ImportWarning
- Warn-raise ImportWarning when importing would have picked up a directory
   as package, if only it'd had an __init__.py. This swaps two tests (for
   case-ness and __init__-ness), but case-test is not really more expensive,
   and it's not in a speed-critical section.

 - Test for the new warning by importing a common non-package directory on
   sys.path: site-packages

 - In regrtest.py, silence warnings generated by the build-environment
   because Modules/ (which is added to sys.path for Setup-created modules)
   has 'zlib' and '_ctypes' directories without __init__.py's.
2006-04-27 23:13:20 +00:00
Thomas Wouters 137b1ad8a0 Do the small-memory run of big-meormy tests using a prime number, rather
than a convenient power-of-2-and-multiple-of-5, so incorrect testing
algorithms fail more easily.
2006-04-27 22:38:32 +00:00
Thomas Wouters 58ac820523 Some style fixes and size-calculation fixes. Also do the small-memory run
using a prime number, rather than a convenient power-of-2-and-multiple-of-5,
so incorrect testing algorithms fail more easily.
2006-04-27 22:37:50 +00:00
Thomas Wouters 2574f5cd8b Some more size-estimate fixes, for large-list-tests. 2006-04-27 13:46:59 +00:00
Anthony Baxter c7d00327ab 2.5a2 2006-04-27 02:11:24 +00:00
Thomas Wouters b5ccd1416e Some more test-size-estimate fixes: test_append and test_insert trigger a
list resize, which overallocates.
2006-04-26 19:14:46 +00:00
Thomas Wouters cda404bf36 Add tests for += and *= on strings, and fix the memory-use estimate for the
list.extend tests (they were estimating half the actual use.)
2006-04-26 18:46:01 +00:00
Tim Peters 687324918f Whitespace normalization. 2006-04-26 17:11:16 +00:00
Thomas Wouters abd08884a6 The result of SF patch #1471578: big-memory tests for strings, lists and
tuples. Lots to be added, still, but this will give big-memory people
something to play with in 2.5 alpha 2, and hopefully get more people to
write these tests.
2006-04-26 15:53:30 +00:00
Neal Norwitz 9cc3b1ccef Fix this test on Solaris. There can be embedded \r, so don't just replace
the one at the end.
2006-04-26 06:26:12 +00:00
Tim Peters d845e53b5b Rev 45706 renamed stuff in contextlib.py, but didn't rename
uses of it in test_with.py.  As a result, test_with has been skipped
(due to failing imports) on all buildbot boxes since.  Alas, that's
not a test failure -- you have to pay attention to the

    1 skip unexpected on PLATFORM:
        test_with

kinds of output at the ends of test runs to notice that this got
broken.

It's likely that more renaming in test_with.py would be desirable.
2006-04-26 01:15:53 +00:00
Guido van Rossum 8f56d02309 Implement MvL's improvement on __context__ in Condition;
this can just call __context__ on the underlying lock.
(The same change for Semaphore does *not* work!)
2006-04-25 20:12:45 +00:00
Thomas Wouters 6dbff33be8 SF bug/patch #1433877: string parameter to ioctl not null terminated
The new char-array used in ioctl calls wasn't explicitly NUL-terminated;
quite probably the cause for the test_pty failures on Solaris that we
circumvented earlier. (I wasn't able to reproduce it with this patch, but it
has been somewhat elusive to start with.)
2006-04-25 13:53:23 +00:00
Nick Coghlan a7e820a408 Move the PEP 343 documentation and implementation closer to the
terminology in the alpha 1 documentation.

 - "context manager" reverts to its alpha 1 definition
 - the term "context specifier" goes away entirely
 - contextlib.GeneratorContextManager is renamed GeneratorContext

There are still a number of changes relative to alpha 1:

  - the expression in the with statement is explicitly called the
    "context expression" in the language reference
  - the terms 'with statement context', 'context object' or 'with
    statement context' are used in several places instead of a bare
    'context'. The aim of this is to avoid ambiguity in relation to the
    runtime context set up when the block is executed, and the context
    objects that already exist in various application domains (such as
    decimal.Context)
  - contextlib.contextmanager is renamed to contextfactory
    This best reflects the nature of the function resulting from the
    use of that decorator
  - decimal.ContextManager is renamed to WithStatementContext
    Simple dropping the 'Manager' part wasn't possible due to the
    fact that decimal.Context already exists and means something
    different. WithStatementContext is ugly but workable.

A technically unrelated change snuck into this commit:
contextlib.closing now avoids the overhead of creating a
generator, since it's trivial to implement that particular
context manager directly.
2006-04-25 10:56:51 +00:00
Tim Peters 711bf30b89 Patch #1475231: add a new SKIP doctest option, thanks to
Edward Loper.
2006-04-25 03:31:36 +00:00
Trent Mick e96b229d2a Put break at correct level so *all* root HKEYs acutally get checked for
an installed VC6. Otherwise only the first such tree gets checked and this
warning doesn't get displayed.
2006-04-25 00:34:50 +00:00
Tim Peters be635cd744 Whitespace normalization. 2006-04-24 22:45:13 +00:00
Phillip J. Eby 0a07ab97c5 Revert addition of setuptools 2006-04-24 20:53:13 +00:00
Thomas Wouters a6c67b56b2 Stop test_tcl's testLoadTk from leaking the Tk commands 'loadtk' registers. 2006-04-24 11:37:13 +00:00
Nick Coghlan 03f76cfbf3 More reliable version of new command line tests that just checks the exit codes 2006-04-24 05:52:15 +00:00
Nick Coghlan 314dadbf98 Back out new command line tests (broke buildbot) 2006-04-24 05:24:26 +00:00
Nick Coghlan 0e01962d51 Fix broken contextlib test from last checkin (I'd've sworn I tested that before checking it in. . .) 2006-04-24 04:59:28 +00:00
Nick Coghlan da2268feec Fix contextlib.nested to cope with exit methods raising and handling exceptions 2006-04-24 04:37:15 +00:00
Nick Coghlan 27ec1a773c Add unit tests for the -m and -c command line switches 2006-04-24 04:32:47 +00:00
Skip Montanaro 7b1559ac26 correct example 2006-04-23 19:32:14 +00:00
Tim Peters 81b7e57e49 Whitespace normalization. 2006-04-23 18:13:45 +00:00
Gerhard Häring 3e99c0ad64 Updated the sqlite3 module to the external pysqlite 2.2.2 version. 2006-04-23 15:24:26 +00:00
Greg Ward ab05edc0d1 Update optparse to Optik 1.5.1. 2006-04-23 03:47:58 +00:00
Hye-Shik Chang cdd432808f Remove $CJKCodecs$ RCS tags. The CJKCodecs isn't maintained outside
anymore.
2006-04-22 15:48:15 +00:00
Tim Peters 6d7cd7d6f4 Whitespace normalization. 2006-04-22 05:52:59 +00:00
Andrew M. Kuchling 1da4a94719 Add Gregory K. Johnson's revised version of mailbox.py (funded by
the 2005 Summer of Code).

The revision adds a number of new mailbox classes that support adding
and removing messages; these classes also support mailbox locking and
default to using email.Message instead of rfc822.Message.

The old mailbox classes are largely left alone for backward compatibility.
The exception is the Maildir class, which was present in the old module
and now inherits from the new classes.  The Maildir class's interface
is pretty simple, though, so I think it'll be compatible with existing
code.

(The change to the NEWS file also adds a missing word to a different
news item, which unfortunately required rewrapping the line.)
2006-04-22 02:32:43 +00:00
Andrew M. Kuchling 81efcf6833 Make copy of test_mailbox.py. We'll still want to check the backward
compatibility classes in the new mailbox.py that I'll be committing in
a few minutes.

One change has been made: the tests use len(mbox) instead of len(mbox.boxes).
The 'boxes' attribute was never documented and contains some internal state
that seems unlikely to have been useful.
2006-04-22 02:06:03 +00:00
Tim Peters 21fbd57d66 SF bug #1473760 TempFile can hang on Windows.
Python 2.4 changed ntpath.abspath to do an import
inside the function.  As a result, due to Python's
import lock, anything calling abspath on Windows
(directly, or indirectly like tempfile.TemporaryFile)
hung when it was called from a thread spawned as a
side effect of importing a module.

This is a depressingly frequent problem, and
deserves a more general fix.  I'm settling for
a micro-fix here because this specific one accounts
for a report of Zope Corp's ZEO hanging on Windows,
and it was an odd way to change abspath to begin
with (ntpath needs a different implementation
depending on whether we're actually running on
Windows, and the _obvious_ way to arrange for that
is not to bury a possibly-failing import _inside_
the function).

Note that if/when other micro-fixes of this kind
get made, the new Lib/test/threaded_import_hangers.py
is a convenient place to add tests for them.
2006-04-21 21:18:10 +00:00
Thomas Heller 6ff67ef096 Merge in changes from ctypes 0.9.9.6 upstream version. 2006-04-21 16:51:04 +00:00
Andrew M. Kuchling b0a1e6b735 Add explanatory message 2006-04-21 12:57:35 +00:00
Skip Montanaro 262fb9256b Allow pstats.Stats creator to specify an alternate to stdout. 2006-04-21 02:31:07 +00:00
Skip Montanaro 94785ef142 Correct implementation and documentation of os.confstr. Add a simple test
case.  I've yet to figure out how to provoke a None return I can test.
2006-04-20 01:29:48 +00:00
Armin Rigo a9017c39ce SF Patch #1062014: AF_UNIX sockets under Linux have a special
abstract namespace that is now fully supported.
2006-04-19 11:50:27 +00:00
Tim Peters 584b0e0c3d Whilespace normalization (reindint.py). 2006-04-18 17:32:12 +00:00
Phillip J. Eby 54ddd23987 Split ``get_platform()`` into ``get_supported_platform()`` and
``get_build_platform()`` to work around a Mac versioning problem that caused
the behavior of ``compatible_platforms()`` to be platform specific.
2006-04-18 15:30:05 +00:00
Armin Rigo 7e97ee6ac8 A dictresize() attack. If oldtable == mp->ma_smalltable then pure
Python code can mangle with mp->ma_smalltable while it is being walked
over.
2006-04-18 14:00:01 +00:00
Michael W. Hudson 15b1f146bc add a very old crasher from the 2.1 -> 2.2 round of dictionary fixes. 2006-04-18 13:52:32 +00:00
Neal Norwitz 041669fa67 Whitespace normalization 2006-04-18 04:53:28 +00:00
Phillip J. Eby 8f925cc050 Handle easy_install being run via -m with no __file__ if done from a
zipfile.
2006-04-18 04:31:46 +00:00
Phillip J. Eby 069159b113 Initial import of setuptools, with integrated tests. 2006-04-18 04:05:34 +00:00
Tim Peters e247e89846 Finally figured out why this module did its imports at the
bottom of the file.  Restored that, and added a comment
explaining why this is necessary.  Hint:  on my box, and
yours, it's not :-(

Also added an __all__ list.
2006-04-18 03:28:32 +00:00
Phillip J. Eby 742cd24c02 test_pyclbr goes nuts when a module contains code to try importing a class
and provide a substitute if the import fails, because pyclbr sees the
class definition.  Changed to ignore such cases' base classes and methods,
since they will not match.
2006-04-18 01:39:25 +00:00
Phillip J. Eby ceb3087e1c Second phase of refactoring for runpy, pkgutil, pydoc, and setuptools
to share common PEP 302 support code, as described here:

http://mail.python.org/pipermail/python-dev/2006-April/063724.html

pydoc now supports PEP 302 importers, by way of utility functions in
pkgutil, such as 'walk_packages()'.  It will properly document
modules that are in zip files, and is backward compatible to Python
2.3 (setuptools installs for Python <2.5 will bundle it so pydoc
doesn't break when used with eggs.)

What has not changed is that pydoc command line options do not support
zip paths or other importer paths, and the webserver index does not
support sys.meta_path.  Those are probably okay as limitations.

Tasks remaining: write docs and Misc/NEWS for pkgutil/pydoc changes,
and update setuptools to use pkgutil wherever possible, then add it
to the stdlib.
2006-04-18 00:59:55 +00:00
Tim Peters c7605f21ae local.__del__(): This didn't actually do anything, because of too
much convolution <0.5 wink>.  Simplified to the point that it works,
and test_threading_local no longer reports leaks under -R.  Thanks
to Thomas Wouters for initial analysis.
2006-04-17 21:12:33 +00:00
Phillip J. Eby ab1d245871 First phase of refactoring for runpy, pkgutil, pydoc, and setuptools
to share common PEP 302 support code, as described here:

http://mail.python.org/pipermail/python-dev/2006-April/063724.html

This revision strips all the PEP 302 emulation code from runpy,
replacing it with published API classes and functions in pkgutil,
mostly using setuptools' implementation of common functionality,
but adding features from runpy, and doing some refactoring to make
the layer pydoc needs easier to implement on top of this.

One step down, four to go, although step #4 (adding C versions of
the new APIs to 'imp') may not be able to make it in time for
alpha 2.  We'll see how that goes.
2006-04-17 20:17:25 +00:00
Martin v. Löwis 1a00e1856e Reindent. 2006-04-17 19:18:18 +00:00
Martin v. Löwis f62eee1c2a Remove bogus character. 2006-04-17 17:37:09 +00:00
Martin v. Löwis bd30f52881 Patch #790710: Add breakpoint command lists in pdb. 2006-04-17 17:08:37 +00:00
Ronald Oussoren 59075eb264 disutils checks if MACOSX_DEPLOYMENT_TARGET is consistent with the value at
configure time. The current check is too strict and doesn't allow building
extensions that can only run on newer versions of the OS than the version
python was build for, that is python build for 10.3 or later and an extension
for 10.4. This patch relaxes this check.

This turned out to be a reimplementation of patch 1193190.
2006-04-17 14:43:30 +00:00
Ronald Oussoren 6c1074888e This patches fixes a number of byteorder problems in MacOSX specific code. 2006-04-17 13:40:08 +00:00
Ronald Oussoren 749d070e93 Teach platform about darwin/x86 2006-04-17 13:37:15 +00:00
Armin Rigo dfde91a79e Fix for a bug exposed by r45232:
/path/to/uninstalled/python setup.py build_ext

now failed with pyconfig.h not found.  Prior to r45232
the above command did not look for pyconfig.h, but the
bug is really in the look-up code: expecting to find it
in os.curdir is a rather fragile idea.
2006-04-17 09:22:35 +00:00
Neal Norwitz 4b16de4350 Add a comment to explain why we are calling _cleanup() 2006-04-17 02:41:25 +00:00
Neal Norwitz 00ac0d22f3 Try to stop the test from leaking and yet still work on windows 2006-04-17 02:39:37 +00:00
Neal Norwitz cb0f66f0ab Get test to consistently show no leaks 2006-04-17 01:48:06 +00:00
Tim Peters aa220a7023 Whitespace normalization. 2006-04-16 22:22:36 +00:00
Tim Peters c5c9ce957d Add missing SVN eol-style property to text files. 2006-04-16 22:11:28 +00:00
Martin v. Löwis 0db2a989f3 Patch #1063914: Add clipboard_get. 2006-04-16 20:55:38 +00:00
Thomas Wouters cb284197f2 Make test_timeout not fail on systems with no dots in their fqdn. 2006-04-16 16:26:28 +00:00
Thomas Wouters 767833dc22 Make test_warnings play nice with regrtest -R:: now that regrtest doesn't
always reload the module (specifically, it doesn't reload if the module has
a 'test_main'.)
2006-04-16 15:43:39 +00:00
Thomas Wouters 993633c6f2 Specialcase 'xs4all' (.nl/.net/.com/whatever else we have) as well as
'python.org' when deciding what server to use for the timeout tests; getting
tired of seeing the test fail on all my boxes ;P This'll still allow the
test to fail for hosts in the XS4ALL network that don't have an 'xs4all'
hostname, so maybe it should use a fallback scheme instead.
2006-04-16 15:22:41 +00:00
Thomas Wouters 631f513fd8 This test no longer leaks, and test_generators sufficiently tests it to
prevent unreported regression.
2006-04-16 15:11:33 +00:00
Thomas Wouters b8f81d4863 Add missing DECREF to PyErr_WriteUnraisable(). That function reports
exceptions that can't be raised any further, because (for instance) they
occur in __del__ methods. The coroutine tests in test_generators was
triggering this leak. Remove the leakers' testcase, and add a simpler
testcase that explicitly tests this leak to test_generators.

test_generators now no longer leaks at all, on my machine. This fix may also
solve other leaks, but my full refleakhunting run is still busy, so who
knows?
2006-04-15 23:27:28 +00:00
Thomas Wouters 60eab2b676 Consolidate 'leak_test1' and 'refleaks_tests', since they both test for the
same kind of thing.
2006-04-15 22:44:07 +00:00
Thomas Wouters b3deb94dc6 Add missing PyObject_GC_Track call, causing *some* itertools.tee objects to
not be tracked by GC. This fixes 254 of test_generators' refleaks on my
machine, but I'm sure something else will make them come back :>

Not adding a separate test for this kind of cycle, since the existing
fib/m235 already test them in more extensive ways than any 'minimal' test
has been able to manage.
2006-04-15 22:33:13 +00:00
Martin v. Löwis 4b501e6c7d Patch #1191700: Adjust column alignment in bdb breakpoint lists.
Backported to 2.4.
2006-04-15 08:41:11 +00:00
Tim Peters 7f098112ee Changed comments to make sense now that the LazyList-based
examples no longer require any explicit closing to avoid
leaking.

That the tee-based examples still do is (I think) still a
mystery.  Part of the mystery is that gc.garbage remains
empty:  if it were the case that some generator in a trash
cycle said it needed finalization, suppressing collection
of that cycle, that generator _would_ show up in gc.garbage.

So this is acting more like, e.g., some tp_traverse slot
isn't visiting all the pointers it should (in which case
the skipped pointer(s) would act like an external root,
silently suppressing collection of everything reachable
from it(them)).
2006-04-15 01:48:57 +00:00
Phillip J. Eby 8ebb28df3a Fix SF#1470508: crash in generator cycle finalization. There were two
problems: first, PyGen_NeedsFinalizing() had an off-by-one bug that
prevented it from ever saying a generator didn't need finalizing, and
second, frame objects cleared themselves in a way that caused their
owning generator to think they were still executable, causing a double
deallocation of objects on the value stack if there was still a loop
on the block stack.  This revision also removes some unnecessary
close() operations from test_generators that are now appropriately
handled by the cycle collector.
2006-04-15 01:02:17 +00:00
Tim Peters c187f33e2b Whitespace normalization. 2006-04-14 18:34:14 +00:00
Walter Dörwald 78a0be6ab3 Add a BufferedIncrementalEncoder class that can be used for implementing
an incremental encoder that must retain part of the data between calls
to the encode() method.

Fix the incremental encoder and decoder for the IDNA encoding.

This closes SF patch #1453235.
2006-04-14 18:25:39 +00:00
Walter Dörwald a40cf31de6 Make error message less misleading for u"a..b".encode("idna"). 2006-04-14 17:00:36 +00:00
Walter Dörwald b17f12bbc6 Fix wrong attribute name. 2006-04-14 15:40:54 +00:00
Walter Dörwald 6493699c0d Make raise statements PEP 8 compatible. 2006-04-14 15:22:27 +00:00
Armin Rigo 969ef7501c Show case: reference cycles involving only the ob_type field are rather
uncommon but possible.  Inspired by SF bug 1469629.
2006-04-14 14:58:30 +00:00
Walter Dörwald 15be5ec100 Call encode()/decode() with final==True as the last call in the
incremental codec tests.
2006-04-14 14:03:55 +00:00
Neal Norwitz 38a76a1017 Copy note from leakers README here too. We want to keep all test cases. 2006-04-14 06:35:46 +00:00
Neal Norwitz 621292237c Restore test tee with some modifications.
The test case came from test_generators, not test_itertools.
Ensure there's no cyclic garbage we are counting.

This is weird because it leaks, then reaches a limit:

python.exe -i test_tee.py
>>> leak()
0
[26633 refs]
>>> leak()
0
[26658 refs]
>>> leak()
0
[26683 refs]
>>> leak()
0
[26708 refs]
>>> leak()
0
[26708 refs]
>>> leak()
0
[26708 refs]
>>> leak()
0
2006-04-14 06:33:24 +00:00
Neal Norwitz cde8750414 Move the old test_generator_cycle.py which leaked but was removed into the test 2006-04-14 06:11:08 +00:00
Neal Norwitz 03f3be50af Update notes to address cyclic garbage and what should happen when a test is fixed. 2006-04-14 05:35:39 +00:00
Tim Peters 7db4f2460f When using -R, lots of "*** DocTestRunner.merge:" nuisance messages
appear.  Get rid of them by nuking doctest's default DocTestRunner
instance as part of cleanup().  Also cleanup() before running the
first test repetition (the test was run once before we get into
the -R branch).
2006-04-13 23:12:24 +00:00
Tim Peters 8e6480ca02 Whitespace normalization. 2006-04-13 22:58:42 +00:00
Georg Brandl 7f573f7319 Add a test for Py_ssize_t. Correct typo in getargs.c. 2006-04-13 07:59:30 +00:00
Neal Norwitz 07c6071729 test_compile can be really long if we are using -u compiler.
This may be causing the debian sparc buildbot to fail.
Print a little message to let the user ^w buildbot know it's still thinking.

We may want to adjust the time period which is currently 5 minutes.

Will backport.
2006-04-13 06:34:59 +00:00
Neal Norwitz 0cfa58c43a Remove tests that no longer leak. There is still one leaking generator test 2006-04-13 04:35:36 +00:00
Tim Peters ba8194bd2a tty isn't supported on all boxes. 2006-04-13 03:09:40 +00:00
Anthony Baxter 57fdcbc60f reverting r45321: Patch #860326: traceback.format_exception_only() now
prepends the exception's module name to non-builtin exceptions, like
the interpreter itself does.

broke a number of doctests. should be discussed before checking in (see
discussion on python-dev).
2006-04-13 01:34:33 +00:00
Georg Brandl 24c274f5dc Patch #860326: traceback.format_exception_only() now prepends the
exception's module name to non-builtin exceptions, like the interpreter
itself does.
2006-04-12 21:14:09 +00:00
Gregory P. Smith 64029986bc Fixes bug #1117761
bsddb.*open() methods cachesize parameter wouldn't work (raised an
internal bsddb.db exception when it was given).  The set_cachesize
call needed to be moved from the DB object to the DBEnv since the env
was introduced to allow for threading.

(will backport to 2.4)
2006-04-12 20:35:02 +00:00
Gregory P. Smith 14c6b4626f Closes bug #1149413
Using None for a filename with the 'n' flag when calling bsddb.btopen
would cause an error while checking if the file None existed.  error
not likely to be seen as anyone using None for a filename would likely
use the 'c' flag in the first place.
2006-04-12 20:16:56 +00:00
Thomas Heller 55d031ef23 Fix for a bug found by Armin Rigo, plus test.
https://sourceforge.net/tracker/?func=detail&atid=532154&aid=1467852&group_id=71702
2006-04-12 19:07:36 +00:00
Georg Brandl 314fce92dd Patch #1468808: don't complain if Tkinter is already deleted at the time Font.__del__ is run. 2006-04-12 15:28:49 +00:00
Georg Brandl f69a24c6ac Update test_sundry. Many modules have now tests, but
e.g. SimpleXMLRPCServer wasn't in here yet.
2006-04-12 12:44:36 +00:00
Anthony Baxter e29002ccb0 Bug #1469163: SimpleXMLRPCServer unconditionally attempted to import fcntl.
Wrapped in a try/except.
2006-04-12 12:07:31 +00:00
Walter Dörwald bc96609555 Patch #1463288: use a context manager to temporarily switch locales.
Add tests for the output of the TextCalendar and HTMLCalendar classes.
2006-04-12 10:09:16 +00:00
Neal Norwitz d3a9162e5e Add another little test to make sure we roundtrip multiple list comp ifs ok.
Add tests for generator expressions too.
2006-04-12 05:27:46 +00:00
Thomas Wouters ced6cddc03 Part two of the fix for SF bug #1466641: Regenerate graminit.c and add test
for the bogus failure.
2006-04-12 00:07:59 +00:00
Vinay Sajip 502348d010 StreamHandler now checks explicitly for None before using sys.stderr as the stream (see SF bug #1463840). 2006-04-11 21:42:00 +00:00
Neal Norwitz 0c469854bc Adjust whitespace. 2006-04-11 07:21:20 +00:00
Neal Norwitz b94a368ff4 Add whitespace after comma 2006-04-11 07:17:08 +00:00