Commit Graph

6091 Commits

Author SHA1 Message Date
Gregory P. Smith 923ba361d8 - Issue #2254: Fix CGIHTTPServer information disclosure. Relative paths are
now collapsed within the url properly before looking in cgi_directories.
2009-04-06 06:33:26 +00:00
Jack Diederich 183028ed79 test the telnetlib.Telnet interface more thoroughly 2009-04-06 02:08:44 +00:00
Gregory P. Smith 6d30793cf2 Fixes issue5705: os.setuid() and friends did not accept the same range of
values that pwd.getpwnam() returns.
2009-04-05 23:43:58 +00:00
Michael Foord f2dfef1637 Adding assertIs and assertIsNot methods to unittest.TestCase
Issue #2578
2009-04-05 19:19:28 +00:00
Georg Brandl 3f0ef20269 #5471: fix expanduser() for $HOME set to "/". 2009-04-05 14:48:49 +00:00
Georg Brandl dc4a77159b #1326077: fix traceback formatting of SyntaxErrors. This fixes two differences with formatting coming from Python: a) the reproduction of location details in the error message if no line text is given, b) the prefixing of the last line by one space. 2009-04-05 14:24:52 +00:00
Vinay Sajip 1e566cec6f Issue #5695: Moved logging.captureWarnings() call inside with statement in WarningsTest.test_warnings. 2009-04-05 11:06:24 +00:00
Hirokazu Yamamoto 772033f08c No behavior change. 2009-04-04 17:20:05 +00:00
Raymond Hettinger 756ab67a98 Have namedtuple's field renamer assign names that
are consistent with the corresponding tuple index.
2009-04-02 22:25:40 +00:00
Antoine Pitrou 789be0c0a0 Issue #2396: backport the memoryview object. 2009-04-02 21:18:34 +00:00
Mark Dickinson 48e3fd240f sys.long_info attributes should be ints, not longs 2009-04-02 18:39:37 +00:00
R. David Murray 52720c5455 Add missing iteritems() call to the for loop in mailbox.MH.get_message().
Fixes issue2625.
2009-04-02 14:05:35 +00:00
Michael Foord e2942d073d Store the functions in the _type_equality_funcs as wrapped objects that are deep copyable.
This allows for the deep copying of TestCase instances.

Issue 5660
2009-04-02 05:51:54 +00:00
Jesse Noller 7152f6d915 Add custom initializer argument to multiprocess.Manager*, courtesy of lekma 2009-04-02 05:17:26 +00:00
Michael Foord 345b2fe21e Better exception messages for unittest assert methods.
- unittest.assertNotEqual() now uses the inequality operator (!=) instead
  of the equality operator.

- Default assertTrue and assertFalse messages are now useful.

- TestCase has a longMessage attribute. This defaults to False, but if set to True
  useful error messages are shown in addition to explicit messages passed to assert methods.

Issue #5663
2009-04-02 03:20:38 +00:00
Senthil Kumaran c730a6a123 Fixing the issue4860. Escaping embedded '"' character in js_output() method of Morsel. 2009-04-02 03:00:34 +00:00
Benjamin Peterson 3633c4f7d2 handle SEEK_ constants in test_io 2009-04-02 01:03:17 +00:00
R. David Murray 3864459196 Add tests checking the CSV module's ability to handle
embedded newlines in quoted field values.
2009-04-01 21:26:18 +00:00
Senthil Kumaran 20d114cad2 Fix for issue5040. Adding test for Content-Length 2009-04-01 20:26:33 +00:00
Jack Diederich 2ecd3c36b5 bounds check arguments to mmap.move(). All of them. Really.
fixes crasher on OS X 10.5
2009-04-01 20:26:13 +00:00
Brett Cannon ce3d221447 test_warnings ironically had a single test that was not protecting the warnings
filter and was resetting it.
2009-04-01 20:25:48 +00:00
Brett Cannon 2da4d628a5 test_logging was blindly clearing the warnings filter. This caused
PendingDeprecationWarnings to be spewed all over by unittest.failIf*(). Fix
moves over to using warnings.catch_warning to protect the warnings filter.
2009-04-01 19:57:10 +00:00
Raymond Hettinger 66c4a6b51c Issue #5647: MutableSet.__iand__() no longer mutates self during iteration. 2009-04-01 18:50:56 +00:00
Brett Cannon 15ba4dae5a _warnings was importing itself to get an attribute. That's bad if warnings gets
called in a thread that was spawned by an import itself.

Last part to close #1665206.
2009-04-01 18:03:59 +00:00
Georg Brandl 61fce3877c Fix test_xmlrpc and make the CGI handler work with no CONTENT_LENGTH. 2009-04-01 15:23:43 +00:00
Jesse Noller 02cb0eb231 Fix multiprocessing.event to match the new threading.Event API 2009-04-01 03:45:50 +00:00
R. David Murray a83da3507f Fix issue 2522. locale.format now checks that it is passed
exactly one pattern, which avoids mysterious errors where it
had seemed to fail to do localization.
2009-04-01 03:21:43 +00:00
Josiah Carlson bb94d43dcd Fix for failing asyncore tests. 2009-04-01 01:28:11 +00:00
Georg Brandl d8fb6ac9da Issue #5635: Fix running test_sys with tracing enabled. 2009-04-01 00:04:33 +00:00
Jack Diederich d60c29ed8b #5228: add pickle support to functools.partial 2009-03-31 23:46:48 +00:00
R. David Murray 840ac926c5 Fix Windows test skip error revealed by buildbot. Also a comment spelling
correction in a previously fixed test.
2009-03-31 23:45:39 +00:00
Georg Brandl 0c7b2c9c19 #1651995: fix _convert_ref for non-ASCII characters. 2009-03-31 22:11:53 +00:00
Benjamin Peterson d906ea62c8 fix Thread.ident when it is the main thread or a dummy thread #5632 2009-03-31 21:34:42 +00:00
Georg Brandl ef660e8e50 #1674032: return value of flag from Event.wait(). OKed by Guido. 2009-03-31 20:41:08 +00:00
Hirokazu Yamamoto 1d7d5325be Issue #5387: Fixed mmap.move crash by integer overflow. (take2) 2009-03-31 20:14:04 +00:00
R. David Murray 612f1d5f48 Remove the regrtest check that turns any ImportError into a skipped test.
Hopefully all modules whose imports legitimately result in a skipped
test have been properly wrapped by the previous commits.
2009-03-31 19:49:15 +00:00
R. David Murray bdeacba51b Improve test_support.import_module docstring, remove
deprecated flag from get_attribute since it isn't likely
to do anything useful.
2009-03-31 19:33:15 +00:00
R. David Murray 73fba6915a Delete out-of-date and little-known README from the test
directory by consensus of devs at pycon sprint.
2009-03-31 19:31:17 +00:00
Gregory P. Smith 7558d57ad2 Rename the actual method definitions to the official assertFoo names.
Adds unittests to make sure the old fail* names continue to work now
and adds a comment that they are pending deprecation.

Also adds a test to confirm that the plural Equals method variants
continue to exist even though we're unlikely to deprecate those.

http://bugs.python.org/issue2578
2009-03-31 19:03:28 +00:00
R. David Murray 597ebab744 A few more test skips via import_module, and change import_module to
return the error message produced by importlib, so that if an import
in the package whose import is being wrapped is what failed the skip
message will contain the name of that module instead of the name of the
wrapped module.  Also fixed formatting of some previous comments.
2009-03-31 18:32:17 +00:00
Gregory P. Smith 2839985c7e The unittest.TestCase.assertEqual() now displays the differences in lists,
tuples, dicts and sets on failure.

Many new handy type and comparison specific assert* methods have been added
that fail with error messages actually useful for debugging.  Contributed in
by Google and completed with help from mfoord and GvR at PyCon 2009 sprints.

Discussion lives in http://bugs.python.org/issue2578.
2009-03-31 16:54:10 +00:00
Jeremy Hylton 88f1c04215 Global statements from one function leaked into parallel functions.
Re http://bugs.python.org/issue4315

The symbol table used the same name dictionaries to recursively
analyze each of its child blocks, even though the dictionaries are
modified during analysis.  The fix is to create new temporary
dictionaries via the analyze_child_block().  The only information that
needs to propagate back up is the names of the free variables.

Add more comments and break out a helper function.  This code doesn't
get any easier to understand when you only look at it once a year.
2009-03-31 13:48:15 +00:00
Jeremy Hylton 1c157ea984 Add is_declared_global() which distinguishes between implicit and
explicit global variables.
2009-03-31 13:17:03 +00:00
Hirokazu Yamamoto 9d2ee5ded2 Issue #5387: Fixed mmap.move crash by integer overflow. 2009-03-31 13:13:05 +00:00
Jesse Noller 82eb5902ce merge in patch from tim golden to fix contextmanager support for mp.Lock() 2009-03-30 23:29:31 +00:00
R. David Murray d7bf8a5478 Actually suppress warnings in test_at_least_import_untested_modules
inside the catch_warnings context manager.
2009-03-30 23:10:37 +00:00
R. David Murray 3db8a3432b Change more tests to use import_module for the modules that
should cause tests to be skipped.  Also rename import_function
to the more descriptive get_attribute and add a docstring.
2009-03-30 23:05:48 +00:00
Jesse Noller 019ce773cd finalize the queue prior to shutdown 2009-03-30 21:53:29 +00:00
Senthil Kumaran 5e95e763e1 Fix for bugs: Issue4675 and Issue4962. 2009-03-30 21:51:50 +00:00
R. David Murray e7c9e092b3 Remove references to test_socket_ssl which was deleted in trunk
in r64392 and py3k in r59038.
2009-03-30 20:04:06 +00:00
R. David Murray 59beec326a Add import_function method to test.test_support, and modify a number of
tests that expect to be skipped if imports fail or functions don't
exist to use import_function and import_module.  The ultimate goal is
to change regrtest to not skip automatically on ImportError.  Checking
in now to make sure the buldbots don't show any errors on platforms
I can't direct test on.
2009-03-30 19:04:00 +00:00
Jesse Noller 459a648166 Issue 5177: use socket.SO_REUSEADDR on multiprocessing SocketManager sockets 2009-03-30 15:50:42 +00:00
R. David Murray 5cb104d1b9 Revert incorrect change. 2009-03-30 15:30:34 +00:00
Benjamin Peterson 68ffe3ec67 don't rely on the order dict repr #5605 2009-03-30 15:15:38 +00:00
R. David Murray ad74dfe8ff Convert import try/except to use test_support.import_module(). 2009-03-30 15:14:01 +00:00
Benjamin Peterson 3c87e2289d add missing import 2009-03-30 14:42:23 +00:00
Benjamin Peterson 8e1a338129 add missing import 2009-03-29 22:27:26 +00:00
Benjamin Peterson 83db7652ca thanks to guido's bytecode verifier, this is fixed 2009-03-29 21:31:05 +00:00
Benjamin Peterson d2c184605e this has been fixed since 2.6 (I love removing these) 2009-03-29 21:22:35 +00:00
Collin Winter a199f01986 Add the ability to control the random seed used by regrtest.py -r.
This adds a --randseed option, and makes regrtest.py -r indicate what random seed it's using so that that value can later be fed back to --randseed. This option is useful for tracking down test order-related issues found by make buildbottest, for example.
2009-03-29 03:44:19 +00:00
Benjamin Peterson 7fa9459baf fix another name 2009-03-26 21:44:43 +00:00
Benjamin Peterson effa1dc709 ** is required here 2009-03-26 21:30:54 +00:00
Benjamin Peterson bf4464a38f add missing import 2009-03-26 21:30:10 +00:00
Benjamin Peterson a9b5be0c05 must pass argument to get expected behavior ;) 2009-03-26 21:11:16 +00:00
Benjamin Peterson bec087f29d fix incorrect auto-translation of TestSkipped -> unittest.SkipTest 2009-03-26 21:10:30 +00:00
Benjamin Peterson ad57d97596 fix naming 2009-03-26 20:49:40 +00:00
Benjamin Peterson 888a39b54c remove test_support.TestSkipped and just use unittest.SkipTest 2009-03-26 20:48:25 +00:00
Benjamin Peterson 21f6aac633 apply the second part of #4242's patch; classify all the implementation details in test_descr 2009-03-26 20:17:27 +00:00
Benjamin Peterson 47d9738b0f rename TestCase.skip() to skipTest() because it causes annoying problems with trial #5571 2009-03-26 20:05:50 +00:00
Benjamin Peterson c3141a6e96 add some useful utilities for skipping tests with unittest's new skipping ability
most significantly apply a modified portion of the patch from #4242 with
patches for skipping implementation details
2009-03-26 19:58:18 +00:00
Benjamin Peterson 0ad9b7727d add support for PyPy 2009-03-26 19:09:21 +00:00
Benjamin Peterson 94e4e2a7e5 roll old test in with new one 2009-03-26 18:58:30 +00:00
Benjamin Peterson b457b89323 more and more implementations now support sys.subversion 2009-03-26 18:55:48 +00:00
Benjamin Peterson f521b8c6d2 add much better tests for python version information parsing 2009-03-26 18:35:37 +00:00
Benjamin Peterson 2f6f7436aa this can be slightly less ugly 2009-03-25 21:42:51 +00:00
Marc-André Lemburg a519cfc953 Remove the sys.version_info shortcut, since they cause the APIs
to return different information than the _sys_version() output
used in previous Python versions.

This also fixes issue5561: platform.python_version_tuple returns tuple of ints, should be strings

Added more tests for the various platform functions.
2009-03-25 19:44:58 +00:00
Benjamin Peterson 2bf74fd0ac this is better written using assertRaises 2009-03-24 03:24:56 +00:00
Benjamin Peterson cb2b0e45d4 comply with the evilJavaNamingScheme for attribute names
It seems my love of PEP 8 overrode the need for consistentcy
2009-03-23 22:29:45 +00:00
Benjamin Peterson 692428e77f implement test skipping and expected failures
patch by myself #1034053
2009-03-23 21:50:21 +00:00
Antoine Pitrou f8387af262 Issue #4688: Add a heuristic so that tuples and dicts containing only
untrackable objects are not tracked by the garbage collector. This can
reduce the size of collections and therefore the garbage collection overhead
on long-running programs, depending on their particular use of datatypes.

(trivia: this makes the "binary_trees" benchmark from the Computer Language
Shootout 40% faster)
2009-03-23 18:41:45 +00:00
Benjamin Peterson 704dc269e3 AttributeError can be thrown during recursion errors 2009-03-22 22:24:58 +00:00
Lars Gustäbel 2020a59563 Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop
forever on incomplete input. That caused tarfile.open() to hang when used
with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or
partial bzip2 compressed data.
2009-03-22 20:09:33 +00:00
Mark Dickinson efc82f7e8e Issue #4258: Use 30-bit digits for Python longs, on 64-bit platforms.
Backport of r70459.
2009-03-20 15:51:55 +00:00
Raymond Hettinger 2412299be9 * Add clearer comment to initialization code.
* Add optional argument to popitem() -- modeled
  after Anthon van der Neut's C version.
* Fix method markup in docs.
2009-03-19 19:59:58 +00:00
Benjamin Peterson 6ffe852f90 fix strange errors when setting attributes on tracebacks #4034 2009-03-18 20:52:15 +00:00
Mark Dickinson b14514a153 Fix bug in _insert_thousands_sep: too much zero padding could be
added for 'n' formats with non-repeating thousands-separator.
2009-03-18 08:22:51 +00:00
Mark Dickinson 277859d591 Issue #2110: Add support for thousands separator and 'n' format specifier
to Decimal __format__ method.
2009-03-17 23:03:46 +00:00
Mark Dickinson b065e52bc2 Fix bug in Decimal __format__ method that swapped left and right
alignment.
2009-03-17 18:01:03 +00:00
Eric Smith 2ace4cf813 Unicode format tests weren't actually testing unicode. This was probably due to the original backport from py3k. 2009-03-14 14:37:38 +00:00
Eric Smith 6f42edb682 Issue 5237, Allow auto-numbered replacement fields in str.format() strings.
For simple uses for str.format(), this makes the typing easier. Hopfully this
will help in the adoption of str.format().

For example:
'The {} is {}'.format('sky', 'blue')

You can mix and matcth auto-numbering and named replacement fields:
'The {} is {color}'.format('sky', color='blue')

But you can't mix and match auto-numbering and specified numbering:
'The {0} is {}'.format('sky', 'blue')
ValueError: cannot switch from manual field specification to automatic field numbering

Will port to 3.1.
2009-03-14 11:57:26 +00:00
Antoine Pitrou feeafff052 Issue #1222: locale.format() bug when the thousands separator is a space character. 2009-03-14 00:07:21 +00:00
Brett Cannon 6c4cff0f32 Require implementations for warnings.showwarning() support the 'line' argument.
Was a DeprecationWarning for not supporting it since Python 2.6.

Closes issue #3652.
2009-03-11 04:51:06 +00:00
Raymond Hettinger 56411aac79 For collections.deque() objects, expose the maxlen parameter as a read-only attribute. 2009-03-10 12:50:59 +00:00
Raymond Hettinger bac769bb5e Small optimization for corner case where maxlen==0. 2009-03-10 09:31:48 +00:00
Hirokazu Yamamoto 09033068f1 mmap.resize for anonymous map is not working yet, so changed to real file mapping... 2009-03-05 14:52:44 +00:00
Hirokazu Yamamoto 264fc12fbf Issue #5385: Fixed mmap crash after resize failure on windows.
Now uses NULL instead of INVALID_HANDLE_VALUE as invalid map handle
because CreateFileMapping returns NULL when error occurs.
2009-03-05 14:21:12 +00:00
Brett Cannon 417937733f Fix some more bugs caused by the backport from 3.x for importlib.
Do a more exact copy of the final 3.x code to resolve bugs and add
appropriate tests.
2009-03-04 01:00:53 +00:00
Raymond Hettinger 131af6505a Backport 70140, 70141, 70143, and 70144.
Adds tests, switches from list to deque, fixes __reduce__
which was unnecessarily copying __keys.
2009-03-03 22:59:25 +00:00
Raymond Hettinger f17f81d9c8 Beef-up tests. 2009-03-03 07:12:09 +00:00
Raymond Hettinger bc512d3abd Backport PEP 372: OrderedDict() 2009-03-03 04:45:34 +00:00
Benjamin Peterson 7d49bba969 give httplib.IncompleteRead a more sane repr #4308 2009-03-02 22:41:42 +00:00
Jeffrey Yasskin 68d6852006 Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} with
POP_JUMP_IF_{TRUE,FALSE} and JUMP_IF_{TRUE,FALSE}_OR_POP. This avoids executing
a POP_TOP on each conditional and sometimes allows the peephole optimizer to
skip a JUMP_ABSOLUTE entirely. It speeds up list comprehensions significantly.
2009-02-28 19:03:21 +00:00
Hirokazu Yamamoto b0e10c760c Issue #1733986: Fixed mmap crash in accessing elements of second map object
with same tagname but larger size than first map. (Windows)
2009-02-28 12:13:07 +00:00
Hirokazu Yamamoto f2dc885780 Issue #5386: mmap.write_byte didn't check map size, so it could cause buffer
overrun.
2009-02-28 10:31:54 +00:00
Brett Cannon ac10be365e Fix a bug where code was trying to index an int. Left over from the situation
from using str.rpartition to str.rindex.

Closes Issue5213.
2009-02-27 03:38:28 +00:00
Benjamin Peterson b3dd5485da remove deprecated symtable.Symbol methods 2009-02-26 19:07:18 +00:00
Brett Cannon b7019d8e9e Expand upon test_site.test_s_option to try to debug its failure. 2009-02-24 22:01:02 +00:00
Raymond Hettinger 8c56f8890e Backport 69934: Register xrange() as a Sequence. 2009-02-24 12:23:23 +00:00
Antoine Pitrou b03f532fe5 Revert debugging statements, culprit is possibly test_distutils (see #5316) 2009-02-22 18:20:46 +00:00
Antoine Pitrou 13d1690ecd Try to make sense of the test_site buildbot failures 2009-02-22 17:25:52 +00:00
Mark Dickinson 3e4caeb3bf Issue #5341: Fix a variety of spelling errors. 2009-02-21 20:27:01 +00:00
Raymond Hettinger aa681c7b99 Fix keyword arguments for itertools.count().
Step arg without a start arg was ignored.
2009-02-21 07:17:22 +00:00
Collin Winter 8725dce2ae Issue 5176: special-case string formatting in BINARY_MODULO implementation. This shows a modest (1-3%) speed-up in templating systems, for example. 2009-02-20 19:30:41 +00:00
Raymond Hettinger 8f9a1eee0d Inline coefficients in gamma(). Add reflection formula. Add comments. 2009-02-19 09:50:24 +00:00
Raymond Hettinger f9bce83e71 Add some cross-references to the docs. Simplify the python code equivalent for izip(). Supply an optional argument for the nth() recipe. 2009-02-19 05:34:35 +00:00
Raymond Hettinger 182edaefb5 Add keyword arg support to itertools.repeat(). 2009-02-19 02:38:25 +00:00
Raymond Hettinger 2e2909f584 Add keyword arg support to itertools.compress(). 2009-02-19 02:15:14 +00:00
Hirokazu Yamamoto 17a837e4db Issue #5282: Fixed mmap resize on 32bit windows and unix. When offset > 0,
The file was resized to wrong size.
2009-02-17 13:17:26 +00:00
Hirokazu Yamamoto f6bbd0e71d Issue #5292: Fixed mmap crash on its boundary access m[len(m)]. 2009-02-17 10:12:10 +00:00
Raymond Hettinger b21d8109af Add GC support to count() objects. Backport candidate. 2009-02-16 20:39:12 +00:00
Mark Dickinson 2ffb26fb83 Issue #5260: Various portability and standards compliance fixes, optimizations
and cleanups in Objects/longobject.c.  The most significant change is that
longs now use less memory:  average savings are 2 bytes per long on 32-bit
systems and 6 bytes per long on 64-bit systems.  (This memory saving already
exists in py3k.)
2009-02-15 10:13:41 +00:00
Georg Brandl f3715d2fc7 #5179: don't leak PIPE fds when child execution fails. 2009-02-14 17:01:36 +00:00
Benjamin Peterson 95777bb019 this needn't be a shebang line 2009-02-14 17:00:51 +00:00
Benjamin Peterson 76afd3b8d0 we're no longer using CVS, so this doesn't have to be binary 2009-02-14 16:51:03 +00:00
Raymond Hettinger a4038038c6 Add keyword argument support to itertools.count(). 2009-02-14 00:25:51 +00:00
Georg Brandl 0638a08a4b #3694: add test for fix committed in r66693. 2009-02-13 11:03:59 +00:00
Gregory P. Smith ea38826ab2 - Issue #3745: Fix hashlib to always reject unicode and non buffer-api
supporting objects as input no matter how it was compiled (built in
  implementations or external openssl library).
(backported from a py3k branch)
2009-02-13 03:00:00 +00:00
Raymond Hettinger dbe3bfbb30 One more test. 2009-02-12 12:43:01 +00:00
Raymond Hettinger aa04461260 Add an extra testcase. 2009-02-12 12:04:26 +00:00
Raymond Hettinger 31c769ca89 Issue 5032: added a step argument to itertools.count() and allowed non-integer arguments. 2009-02-12 05:39:46 +00:00
Gregory P. Smith 3605b5cee3 Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
on LP64 platforms (most 64-bit Linux, bsd, unix systems).
2009-02-11 23:45:25 +00:00
Mark Dickinson 4015f62e39 Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for
negative arguments.  Previously, it raised TypeError.

Thanks Lisandro Dalcin.
2009-02-10 15:46:50 +00:00
Brett Cannon 28d108893c compileall used the ctime of bytecode and source to determine if the bytecode
should be recreated. This created a timing hole. Fixed by just doing what
import does; check the mtime and magic number.
2009-02-10 02:07:38 +00:00
Raymond Hettinger 322daea7c3 Issue 1818: collections.namedtuple() to support automatic renaming of invalid fieldnames. 2009-02-10 01:24:05 +00:00
Guilherme Polo 55bdb8e4ac Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly) 2009-02-09 19:57:04 +00:00
Guilherme Polo bbb7efd72b Some tests for Tkinter.Text.search 2009-02-09 19:21:21 +00:00
Vinay Sajip b20af944d2 Issue #5170: Fixed Unicode output bug in logging and added test case. This is a regression which did not occur in 2.5. 2009-02-08 19:06:08 +00:00
Nick Coghlan 0194f5bc98 Issue #4512 closeout: Make ZipImport.get_filename() a public method 2009-02-08 03:17:00 +00:00
Nick Coghlan d39600e69f Issue 4195: Restore the ability to execute packages with the -m switch (but this time in a way that leaves the import machinery in a valid state). (Original patch by Andi Vajda) 2009-02-08 01:26:34 +00:00
Benjamin Peterson 096c3ad41d make destinsrc private 2009-02-07 19:08:22 +00:00
Neil Schemenauer f8741eacf5 Add test for issue #999042, explict global statement works. 2009-02-07 18:35:16 +00:00
Neil Schemenauer 8573d62f8f Fix broken test in test_hotshot. Treating the current directory as an
empty file is sloppy and non-portable.  Use NamedTemporaryFile to make
an empty file.
2009-02-07 14:53:31 +00:00
Guilherme Polo 8e5e438d21 Eliminated the need to use ttk.__loadtk__ and the problems related it. 2009-02-07 02:20:29 +00:00
Armin Rigo 5561986da3 Ivan on IRC in #twisted reported this crasher. 2009-02-06 11:46:26 +00:00
Kristján Valur Jónsson e20f54f542 Fix a number of Win32ErrorTests error cases. chmod wasn't being tested. 'access' never raises an error. 2009-02-06 10:17:34 +00:00
Eric Smith 81fe09344c Implement issue #4285, convert sys.version_info to a named
tuple. Patch by Ross Light.
2009-02-06 00:48:26 +00:00
Raymond Hettinger d507afdc81 Minor doc fixups. 2009-02-04 10:52:32 +00:00
Kristján Valur Jónsson fd4c872726 issue 4804: Provide checks for the format string of strftime, and for the "mode" string of fopen on Windows. These strings are user provided from python and so we can avoid invoking the C runtime invalid parameter handler by first checking that they are valid. 2009-02-04 10:05:25 +00:00
Raymond Hettinger 2c8585b0af Register decimals as numbers.Number 2009-02-03 03:37:03 +00:00
Raymond Hettinger d6fc2623c5 Validate that __length_hint__ returns a usable result. 2009-02-03 02:23:19 +00:00
Raymond Hettinger b516370bcb Issue 1242657: list(obj) can swallow KeyboardInterrupt. 2009-02-02 21:50:13 +00:00
Guilherme Polo 3b331dd3ea Restore Tkinter.Tk._loadtk so this test doesn't fail for problems
related to ttk.
2009-02-01 02:56:16 +00:00
Gregory P. Smith de1a8b720a - Issue #5104: The socket module now raises OverflowError when 16-bit port and
protocol numbers are supplied outside the allowed 0-65536 range on bind()
  and getservbyport().
2009-01-31 22:57:30 +00:00
Mark Dickinson f709ab8526 Add an extra test for long <-> float hash equivalence. 2009-01-31 16:44:04 +00:00
Benjamin Peterson 1de05e9b2a check the errno in bad fd cases 2009-01-31 01:42:55 +00:00
Benjamin Peterson b3619be995 make _tkinter._flatten check the result of PySequence_Size for errors #3880 2009-01-30 02:24:39 +00:00
Antoine Pitrou 707c593761 Issue #2047: shutil.move() could believe that its destination path was
inside its source path if it began with the same letters (e.g. "src" vs.
"src.new").
2009-01-29 20:19:34 +00:00
Raymond Hettinger f779e6f51b Issue 4920: Fixed next() vs __next__() issues in the ABCs
for Iterator and MutableSet.  Also added thorough test for
required abstractmethods.
2009-01-28 23:02:26 +00:00
Guilherme Polo b1a98de25e Issue #5083: New 'gui' resource for regrtest. 2009-01-28 20:03:26 +00:00
Guilherme Polo 7a77ee88af * Renaming test_tk_* to test_ttk_* since that is what they are testing.
* Added ttk tests to the expected skips mapping just like where test_tcl
was expected to be skipped too.
2009-01-28 19:28:04 +00:00
Guilherme Polo cda93aafde Added the ttk module. See issue #2983: Ttk support for Tkinter. 2009-01-28 13:09:03 +00:00
Raymond Hettinger 560f9a8a90 Add more tests for the powerset() recipe. 2009-01-27 13:26:35 +00:00
Raymond Hettinger 2f6c2e03a8 More exhaustive combinatoric checks. 2009-01-27 10:36:14 +00:00
Raymond Hettinger f93f3032c6 Stronger tests for combinatoric relationships. 2009-01-27 09:52:35 +00:00
Raymond Hettinger 2976aaa396 Add tests to verify combinatoric relationships. 2009-01-27 09:33:06 +00:00
Raymond Hettinger d081abc8be Promote combinations_with_replacement() from a recipe to a regular itertool. 2009-01-27 02:58:49 +00:00
Brett Cannon 93881c6c58 Backport importlib in the form of providing importlib.import_module(). This has
been done purely to help transitions from 2.7 to 3.1.
2009-01-26 01:16:50 +00:00
Raymond Hettinger 68d919e4d6 Improved itertools recipe for generating powerset(). 2009-01-25 21:31:47 +00:00
Raymond Hettinger 2bcb8e9b0d Promote compress() from a recipe to being a regular itertool. 2009-01-25 21:04:14 +00:00
Tarek Ziadé 1af3b5a9a4 Issue #4863, removing remaining bits 2009-01-25 19:29:10 +00:00
Benjamin Peterson 78821ddf8c fix building the core with --disable-unicode
I changed some bytearray methods to use strings instead of unicode like bytes_repr
Also, bytearray.fromhex() can take strings as well as unicode
2009-01-25 17:15:10 +00:00
Mark Dickinson a3ecd2c668 Issue #1672332: Fix unpickling of subnormal floats, which was raising
ValueError on some platforms as a result of the platform strtod setting
errno on underflow.
2009-01-24 16:40:29 +00:00
Mark Dickinson c187d11af3 Issue #5025: Fix occasional test_kqueue failure on OS X. 2009-01-24 16:17:27 +00:00
Martin v. Löwis 0dfcfc8b59 Issue #4710: Extract directories properly in the zipfile module;
allow adding directories to a zipfile.
2009-01-24 14:00:33 +00:00
Kristján Valur Jónsson 89e759d462 Add a test for UNC import paths, see issue 3677 2009-01-24 10:52:26 +00:00
Raymond Hettinger 0a1f7b8f72 Tighten-up the docs for Counter(). 2009-01-21 23:12:51 +00:00
Raymond Hettinger 4571f347f9 Simplify explanation of multiset operations by removing restrictions on negative inputs. 2009-01-21 20:31:50 +00:00
Jesse Noller 7314b38168 Issue 5009: multiprocessing: failure in manager._debug_info() 2009-01-21 02:08:17 +00:00
Antoine Pitrou e741cc607c Issue #5008: When a file is opened in append mode with the new IO library,
do an explicit seek to the end of file (so that e.g. tell() returns the
file size rather than 0). This is consistent with the behaviour of the
traditional 2.x file object.
2009-01-21 00:45:36 +00:00
Raymond Hettinger 933d3a7a54 Issue 4998: __slots__ on Fractions was useless. 2009-01-20 20:34:19 +00:00
Benjamin Peterson e18ef194d9 allow unicode keyword arguments for the ** syntax #4978 2009-01-20 14:21:16 +00:00
Raymond Hettinger bad1eb2ff3 Build-outs for Counter() class:
* Constructor and update() support keyword args (like their dict counterparts).
* The 'del' statement no longer raises KeyError for missing values.
* Add multiset operations:  __add__, __sub__, __and__, __or__.
2009-01-20 01:19:26 +00:00
Benjamin Peterson 1f01cd013f I'm sick of these deprecations warnings in test_os 2009-01-19 21:08:37 +00:00
Benjamin Peterson 5539c78391 make bad file descriptor tests more robust 2009-01-19 17:37:42 +00:00
Jesse Noller 9a5b2ad38d Resolve issue 3321: (segfault) _multiprocessing.Connection() doesn't check handle 2009-01-19 15:12:22 +00:00
Kristján Valur Jónsson 2e659ce36f Issue 4957
Let os.ftruncate raise OSError like documented.
2009-01-19 13:10:27 +00:00
Benjamin Peterson 5848d1ff35 raise an OSError for invalid fds #4991 2009-01-19 00:08:08 +00:00
Benjamin Peterson 910f216260 fix test that wasn't working as expected #4990 2009-01-18 21:11:38 +00:00
Kristján Valur Jónsson 60e79ced94 issue 4293: make test_capi.py more robutst, it times out on some platforms, presumably waiting for threads. Lower the thread count to 16. 2009-01-18 10:58:44 +00:00
Jesse Noller 6ab22154dd Resolve issue 4449: AssertionError in mp_benchmarks.py 2009-01-18 02:45:38 +00:00
Benjamin Peterson 5e5fbb612d fix inspect.isclass() on instances with a custom __getattr__ #1225107 2009-01-17 22:27:54 +00:00
Benjamin Peterson f320c22701 trying to find some fpathconf() settings that all unixs support... 2009-01-17 04:39:05 +00:00
Benjamin Peterson b3af601b22 compare with == not is #4946 2009-01-16 02:55:24 +00:00
Kristján Valur Jónsson 4f69b7e33b Make all the invalid fd tests for os subject to the function being available. 2009-01-15 22:46:26 +00:00
Kristján Valur Jónsson 71ba215d6b Fix two test cases in test_os. ftruncate raises IOError unlike all the others which raise OSError. And close() on some platforms doesn't complain when given an invalid file descriptor. 2009-01-15 22:40:03 +00:00
Mark Dickinson 0e15182a38 Comment typo 2009-01-15 14:58:28 +00:00
Mark Dickinson e82cdae58f Issue #4397. Fix occasional test_socket failure on OS X. 2009-01-15 14:54:37 +00:00
Kristján Valur Jónsson 8adc0b54d4 Fix recently introduced test cases.
For datetime, gentoo didn't seem to mind the %e format for strftime.  So, we just excercise those instead making sure that we don't crash.
For test_os, two cases were incorrect.
2009-01-15 09:09:13 +00:00
Kristján Valur Jónsson 018760e3dc Re-enable all tests for windows platforms.
Also, explicitly connect to the IPV4 address.  On windows platforms supporting AF_INET6, the SocketProxy would connect using socket.create_connection('localhost', port) which would cycle through all address families and try to connect.  It would try connecting using AF_INET6 first and this would cause a delay of up to a second.
2009-01-14 10:50:57 +00:00
Raymond Hettinger afd112baef Add tests for __init__() and update() with no args. 2009-01-14 01:15:06 +00:00
Amaury Forgeot d'Arc b54447f31c #1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
2009-01-13 23:39:22 +00:00
Georg Brandl b24c9519b4 Use assertRaises. 2009-01-13 22:14:01 +00:00
Armin Ronacher dd53e114ef ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907. 2009-01-13 11:52:23 +00:00
Raymond Hettinger aaa6e630f8 Simplify Counter() API. Replace items keyword argument
with a mapping.  Makes Counter() idempotent, makes update()
API the same as Counter.__init__(), makes a more readable
repr, makes the API more dict-like, and allows Steven
Bethard's update() example to work.
2009-01-13 01:05:03 +00:00
Amaury Forgeot d'Arc a40d573664 #3720: Interpreter crashes when an evil iterator removes its own next function.
Now the slot is filled with a function that always raises.

Will not backport: extensions compiled with 2.6.x would not run on 2.6.0.
2009-01-12 23:36:55 +00:00
Raymond Hettinger f94d7fa5fb Issue 1696199: Add collections.Counter(). 2009-01-12 22:58:41 +00:00
Kristján Valur Jónsson 1c62b650d0 Add tests for invalid format specifiers in strftime, and for handling of invalid file descriptors in the os module. 2009-01-12 18:09:27 +00:00
Kristján Valur Jónsson 3c43fcba8b Issue 4879: Allow buffering for HTTPResponse 2009-01-11 16:23:37 +00:00
Mark Dickinson da62f81d1d Remove an unnecessary check from test_decimal. 2009-01-10 19:14:55 +00:00
Antoine Pitrou b74fc2b5fe Issue #3860: GzipFile and BZ2File now support the context manager protocol. 2009-01-10 16:13:45 +00:00
Kristján Valur Jónsson 0e2d8c36e3 Issue 4293: Make Py_AddPendingCall() thread safe
Add test cases and documentation
2009-01-09 21:35:16 +00:00
Raymond Hettinger 5b913e31a1 Forward port r68394 for issue 4816. 2009-01-08 06:39:04 +00:00
Antoine Pitrou 09cafb6335 Use shutil.rmtree rather than os.rmdir. 2009-01-06 18:34:08 +00:00
Antoine Pitrou e96d4ea4e2 Issue #1180193: When importing a module from a .pyc (or .pyo) file with
an existing .py counterpart, override the co_filename attributes of all
code objects if the original filename is obsolete (which can happen if the
file has been renamed, moved, or if it is accessed through different paths).
Patch by Ziga Seilnacht and Jean-Paul Calderone.
2009-01-06 18:10:47 +00:00
Antoine Pitrou f0d2c3f730 Issue #4272: Add an optional argument to the GzipFile constructor to override the timestamp in the gzip stream. 2009-01-04 21:29:23 +00:00
Georg Brandl fe427895b5 Manually merge r68095,68186,68187,68188,68190 from 2.6 branch. 2009-01-03 22:03:11 +00:00
Raymond Hettinger f4d8597a59 Issue 4796: Add from_float methods to the decimal module. 2009-01-03 19:02:23 +00:00
Raymond Hettinger 44e1581df3 Issue #4615. Document how to use itertools for de-duping. 2009-01-02 21:26:45 +00:00
Ronald Oussoren 0238497e93 Fix for issue1594 2009-01-02 14:10:20 +00:00
Antoine Pitrou 733dc74442 fill in actual issue number in tests 2009-01-01 15:38:03 +00:00
Antoine Pitrou aa687902f2 Issue #3680: Reference cycles created through a dict, set or deque iterator did not get collected. 2009-01-01 14:11:22 +00:00
Georg Brandl 6269fec171 #4228: Pack negative values the same way as 2.4
in struct's L format.
2009-01-01 12:15:31 +00:00
Nick Coghlan 180e400766 Issue #4701: implicitly call PyType_Ready from PyObject_Hash 2008-12-30 01:18:48 +00:00
Benjamin Peterson 7af65568ff #4764 in io.open, set IOError.filename when trying to open a directory on POSIX platforms 2008-12-29 17:56:58 +00:00
Benjamin Peterson fe231b07e4 #4764 set IOError.filename when trying to open a directory on POSIX platforms 2008-12-29 17:47:42 +00:00
Antoine Pitrou 697ca3d0cb Issue #4444: Allow assertRaises() to be used as a context handler. 2008-12-28 14:09:36 +00:00
Georg Brandl 6425a2fa8f Backport r67974:
#4759: allow None as first argument of bytearray.translate(), for consistency with bytes.translate().

Also fix segfault for bytearray.translate(x, None) -- will backport this part to 3.0 and 2.6.
2008-12-28 11:54:53 +00:00
Benjamin Peterson 8d5934b25d #4748 lambda generators shouldn't return values 2008-12-27 18:24:11 +00:00
Antoine Pitrou 6f193e0e95 Issue #4756: zipfile.is_zipfile() now supports file-like objects.
Patch by Gabriel Genellina.
2008-12-27 15:43:12 +00:00
Alexandre Vassalotti e57e9990e7 Fix bogus unicode tests in pickletester. 2008-12-27 10:02:59 +00:00
Alexandre Vassalotti f852bf97ef Fix issue #4730: cPickle corrupts high-unicode strings.
Update outdated copy of PyUnicode_EncodeRawUnicodeEscape.
Add a test case.
2008-12-27 07:08:47 +00:00
Hirokazu Yamamoto 0fc0747586 Issue #4740: Use HIGHEST_PROTOCOL in pickle test.
(There is no behavior difference in 2.x because HIGHEST_PROTOCOL == 2)
2008-12-27 04:19:48 +00:00
Benjamin Peterson 54686e3c29 #4736 BufferRWPair.closed shouldn't try to call another property as a function 2008-12-24 15:10:27 +00:00
Skip Montanaro f205c13fac As a result of a regression that snuck into 2.5.3 add a test case that
ensures that when you try to read from a file opened for writing an IOError
is raised.
2008-12-23 03:30:15 +00:00
Benjamin Peterson f09925da67 add py3k warnings to frame.f_exc_* 2008-12-22 20:16:25 +00:00
Mark Dickinson 1a707981c8 Issue #3439: add bit_length method to int and long.
Thanks Fredrik Johansson and Victor Stinner for code,
Raymond Hettinger for review.
2008-12-17 16:14:37 +00:00
Antoine Pitrou d0c3515bc5 Issue #2183: Simplify and optimize bytecode for list comprehensions. 2008-12-17 00:38:28 +00:00
Amaury Forgeot d'Arc 31949b9108 #3954: Fix error handling code in _hotshot.logreader
Will port to 2.6. hotshot was deleted from python 3.
2008-12-15 21:47:57 +00:00
Nick Coghlan 68060013ea Issue #4197: Fix the remaining part of the doctest-in-zipfile problem by giving linecache access to the module globals when available 2008-12-15 11:41:05 +00:00
Antoine Pitrou cc5b64a70a modify other occurrence of test_bad_address 2008-12-15 00:39:51 +00:00
Antoine Pitrou 122388a5a5 try to fix failure in test_bad_address on some buildbots 2008-12-14 22:33:55 +00:00
Antoine Pitrou 655fbf1806 Backport r67759 (fix io.IncrementalNewlineDecoder for UTF-16 et al.). 2008-12-14 17:40:51 +00:00
Nick Coghlan bbba3f0cec Add file that was missed from r67750 2008-12-14 11:09:40 +00:00
Nick Coghlan a2053475bb Fix several issues relating to access to source code inside zipfiles. Initial work by Alexander Belopolsky. See Misc/NEWS in this checkin for details. 2008-12-14 10:54:50 +00:00
Antoine Pitrou 74af3bbfbd Issue #4163: Use unicode-friendly word splitting in the textwrap functions when given an unicode string. 2008-12-13 23:12:30 +00:00
Lars Gustäbel 3b02742f7d Issue #4616: TarFile.utime(): Restore directory times on Windows. 2008-12-12 13:58:03 +00:00
Facundo Batista e29d435e0c Issue #4084: Fix max, min, max_mag and min_mag Decimal methods to
give correct results in the case where one argument is a quiet NaN
and the other is a finite number that requires rounding.
Thanks Mark Dickinson.
2008-12-11 04:19:46 +00:00
Amaury Forgeot d'Arc ad9b5992e3 #4559: When a context manager's __exit__() method returns an object whose
conversion to bool raises an exception, 'with' loses that exception.

Reviewed by Jeffrey Yasskin.
Already ported to 2.5, will port to 2.6 and 3.0
2008-12-10 23:22:49 +00:00
Jeremy Hylton 1868d7c221 Add simple unittests for Request 2008-12-09 21:03:10 +00:00
Jeffrey Yasskin 2d873bd68b Issue 4597: Fix several cases in EvalFrameEx where an exception could be
"raised" without setting x, err, or why to let the eval loop know.
2008-12-08 18:55:24 +00:00