Commit Graph

10957 Commits

Author SHA1 Message Date
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