Commit Graph

12789 Commits

Author SHA1 Message Date
Eric Smith 0aed07ad80 Added PEP 3127 support to tokenize (with tests); added PEP 3127 to NEWS. 2008-03-17 19:43:40 +00:00
Gregory P. Smith f48f9d38c0 Force zlib.crc32 and zlib.adler32 to return a signed integer on all platforms
regardless of the native sizeof(long) used in the integer object.

This somewhat odd behavior of returning a signed is maintained in 2.x for
compatibility reasons of always returning an integer rather than a long object.

Fixes Issue1202 for Python 2.6
2008-03-17 18:48:05 +00:00
Eric Smith 9ff19b5434 Finished backporting PEP 3127, Integer Literal Support and Syntax.
Added 0b and 0o literals to tokenizer.
Modified PyOS_strtoul to support 0b and 0o inputs.
Modified PyLong_FromString to support guessing 0b and 0o inputs.
Renamed test_hexoct.py to test_int_literal.py and added binary tests.
Added upper and lower case 0b, 0O, and 0X tests to test_int_literal.py
2008-03-17 17:32:20 +00:00
Jeffrey Yasskin b9e15f7555 Make isinstance(OldstyleClass, NewstyleClass) return False instead of raising
an exception. Issue reported by Joseph Armbruster.
2008-03-17 16:31:21 +00:00
Eric Smith 8113ca63b9 Issue 2264: empty float presentation type needs to have at least one digit past the decimal point.
Added "Z" format_char to PyOS_ascii_formatd to support empty float presentation type.
Renamed buf_size in PyOS_ascii_formatd to more accurately reflect it's meaning.
Modified format.__float__ to use the new "Z" format as the default.
Added test cases.
2008-03-17 11:01:01 +00:00
Raymond Hettinger cd6bfab410 Zap one more use of Exact/Inexact. 2008-03-15 20:37:50 +00:00
Raymond Hettinger 6b46762974 Removed Exact/Inexact after discussion with Yasskin.
Unlike Scheme where exactness is implemented as taints, the Python
implementation associated exactness with data types.  This created
inheritance issues (making an exact subclass of floats would result
in the subclass having both an explicit Exact registration and an
inherited Inexact registration).  This was a problem for the
decimal module which was designed to span both exact and inexact
arithmetic.  There was also a question of use cases and no examples
were found where ABCs for exactness could be used to improve code.
One other issue was having separate tags for both the affirmative
and negative cases.  This is at odds with the approach taken
elsewhere in the Python (i.e. we don't have an ABC both Hashable
and Unhashable).
2008-03-15 20:02:04 +00:00
Skip Montanaro fc070d2731 add %f format to datetime - issue 1158 2008-03-15 16:04:45 +00:00
Mark Dickinson c23b8a7af9 Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms:  it should now raise OverflowError on all
platforms.  (Previously it raised OverflowError only on
non IEEE 754 platforms.)

Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
2008-03-14 14:23:37 +00:00
Brett Cannon 6119540d70 Remove a bad test. 2008-03-14 14:03:10 +00:00
Brett Cannon 1f5182b572 Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
2008-03-13 21:09:28 +00:00
Brett Cannon 4a6e8d669a Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
2008-03-13 21:02:16 +00:00
Brett Cannon 2e0f9f3dd9 Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
2008-03-13 20:47:41 +00:00
Brett Cannon b8d37359cd Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
2008-03-13 20:33:10 +00:00
Brett Cannon 66865d2ebd Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
2008-03-13 20:27:00 +00:00
Raymond Hettinger 83aa6a3b1a Simplify the nlargest() code using heappushpop(). 2008-03-13 19:33:34 +00:00
Raymond Hettinger 53bdf09343 Issue 2274: Add heapq.heappushpop(). 2008-03-13 19:03:51 +00:00
Raymond Hettinger e8b4b60555 Add recipe to docs. 2008-03-11 00:19:07 +00:00
Neal Norwitz 0098c9d609 Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
2008-03-09 19:03:42 +00:00
Facundo Batista c54aec1fda Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
2008-03-08 16:50:27 +00:00
Marc-André Lemburg 50967bdec2 Add new name for Mandrake: Mandriva. 2008-03-08 10:01:43 +00:00
Nick Coghlan 7af53be66f Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files) 2008-03-07 14:13:28 +00:00
Jeffrey Yasskin e75f59a578 Progress on issue #1193577 by adding a polling .shutdown() method to
SocketServers. The core of the patch was written by Pedro Werneck, but any bugs
are mine. I've also rearranged the code for timeouts in order to avoid
interfering with the shutdown poll.
2008-03-07 06:22:15 +00:00
Raymond Hettinger 38fb9bee6c Tweak recipes and tests 2008-03-07 01:33:20 +00:00
Raymond Hettinger a1ca94a102 Issue 2246: itertools grouper object did not participate in GC (should be backported). 2008-03-06 22:51:36 +00:00
Raymond Hettinger ad47fa141c More tests. 2008-03-06 20:52:01 +00:00
Georg Brandl 4286138e7b #2220: handle matching failure more gracefully. 2008-03-06 07:43:02 +00:00
Georg Brandl a7bd27f0a8 #2225: return nonzero status code from py_compile if not all files could be compiled. 2008-03-06 07:41:16 +00:00
Martin v. Löwis d2bbe526c3 Patch #2232: os.tmpfile might fail on Windows if the user has no
permission to create files in the root directory.
Will backport to 2.5.
2008-03-06 06:55:22 +00:00
Georg Brandl 1df03405fc #1725737: ignore other VC directories other than CVS and SVN's too. 2008-03-06 06:47:18 +00:00
Raymond Hettinger 66f91ea966 C implementation of itertools.permutations(). 2008-03-05 20:59:58 +00:00
Thomas Heller f3c0559b5e Issue 1872: Changed the struct module typecode from 't' to '?', for
compatibility with PEP3118.
2008-03-05 15:34:29 +00:00
Jeffrey Yasskin f28896d0bb Fix test_socketserver on Windows after r61099 added several signal.alarm()
calls (which don't exist on non-Unix platforms).

Thanks to Trent Nelson for the report and patch.
2008-03-05 06:19:56 +00:00
Neal Norwitz 48309d5a4b Make the timeout longer to give slow machines a chance to pass the test
before timing out.  This doesn't change the duration of the test under
normal circumstances.  This is targetted at fixing the spurious failures
on the FreeBSD buildbot primarily.
2008-03-05 05:38:06 +00:00
Neal Norwitz ce527883dc Catch OSError when trying to remove a file in case removal fails. This
should prevent a failure in tearDown masking any real test failure.
2008-03-05 05:20:44 +00:00
Neal Norwitz 218072595e Get this test to pass even when there is no sound card in the system.
Patch from Trent Nelson.  (I can't test this.)
2008-03-05 05:14:18 +00:00
Neal Norwitz 31e88934ed Remove the files/dirs after closing the DB so the tests work on Windows.
Patch from Trent Nelson.  Also simplified removing a file by using test_support.
2008-03-05 05:10:48 +00:00
Amaury Forgeot d'Arc d21fb4c2e0 Issue#2238: some syntax errors from *args or **kwargs expressions
would give bogus error messages, because of untested exceptions::

    >>> f(**g(1=2))
    XXX undetected error
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: 'int' object is not iterable

instead of the expected SyntaxError: keyword can't be an expression

Will backport.
2008-03-05 01:50:33 +00:00
Fred Drake a28df13a9d fix typo 2008-03-04 21:14:04 +00:00
Neal Norwitz 4a50d26ba2 Close the file before trying to remove the directory so it works on Windows.
As reported by Trent Nelson on python-dev.
2008-03-04 16:22:46 +00:00
Raymond Hettinger d553d856e7 Beef-up docs and tests for itertools. Fix-up end-case for product(). 2008-03-04 04:17:08 +00:00
Raymond Hettinger 10ac19bedc Issue 2226: Callable checked for the wrong abstract method. 2008-03-03 22:19:58 +00:00
Raymond Hettinger 972fb077a0 Remove dependency on itertools -- a simple genexp suffices. 2008-03-03 22:04:55 +00:00
Georg Brandl d2f7680b8f Actually import itertools. 2008-03-03 21:22:47 +00:00
Georg Brandl 26bc177fe6 15 -> 16, the 2nd 2008-03-03 20:39:00 +00:00
Christian Heimes 728bee897f 15 -> 16 2008-03-03 20:30:29 +00:00
Christian Heimes 608c1d8e87 Since abc._Abstract was replaces by a new type flags the regression test suite fails. I've added a new function inspect.isabstract(). Is the mmethod fine or should I check if object is a instance of type or subclass of object, too? 2008-03-03 18:28:04 +00:00
Brett Cannon 7dbd91811d Add test_main() functions to various tests where it was simple to do. Done so
that regrtest can execute the test_main() directly instead of relying on import
side-effects.
2008-03-03 04:19:29 +00:00
Brett Cannon 963c80fd45 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:26:43 +00:00
Brett Cannon bfbf5b3715 Add a note in the main test class' docstring that the order of execution of the
tests is important.
2008-03-03 03:24:48 +00:00