2005-06-13 18:44:48 -03:00
|
|
|
import unittest
|
2008-05-20 18:35:26 -03:00
|
|
|
from test import support
|
2010-12-04 11:17:38 -04:00
|
|
|
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
import sys
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
import random
|
2008-12-17 12:19:07 -04:00
|
|
|
import math
|
2010-01-09 16:35:09 -04:00
|
|
|
import array
|
2005-06-13 18:44:48 -03:00
|
|
|
|
1998-08-13 11:20:17 -03:00
|
|
|
# SHIFT should match the value in longintrepr.h for best testing.
|
2009-03-18 17:06:12 -03:00
|
|
|
SHIFT = sys.int_info.bits_per_digit
|
1998-08-13 11:20:17 -03:00
|
|
|
BASE = 2 ** SHIFT
|
|
|
|
MASK = BASE - 1
|
2004-08-30 20:18:23 -03:00
|
|
|
KARATSUBA_CUTOFF = 70 # from longobject.c
|
1998-08-13 11:20:17 -03:00
|
|
|
|
|
|
|
# Max number of base BASE digits to use in test cases. Doubling
|
2002-08-12 23:17:11 -03:00
|
|
|
# this will more than double the runtime.
|
|
|
|
MAXDIGITS = 15
|
1998-08-13 11:20:17 -03:00
|
|
|
|
1998-10-01 22:19:48 -03:00
|
|
|
# build some special values
|
Merged revisions 56125-56153 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r56127 | georg.brandl | 2007-06-30 09:32:49 +0200 (Sat, 30 Jun 2007) | 2 lines
Fix a place where floor division would be in order.
........
r56135 | guido.van.rossum | 2007-07-01 06:13:54 +0200 (Sun, 01 Jul 2007) | 28 lines
Make map() and filter() identical to itertools.imap() and .ifilter(),
respectively.
I fixed two bootstrap issues, due to the dynamic import of itertools:
1. Starting python requires that map() and filter() are not used until
site.py has added build/lib.<arch> to sys.path.
2. Building python requires that setup.py and distutils and everything
they use is free of map() and filter() calls.
Beyond this, I only fixed the tests in test_builtin.py.
Others, please help fixing the remaining tests that are now broken!
The fixes are usually simple:
a. map(None, X) -> list(X)
b. map(F, X) -> list(map(F, X))
c. map(lambda x: F(x), X) -> [F(x) for x in X]
d. filter(F, X) -> list(filter(F, X))
e. filter(lambda x: P(x), X) -> [x for x in X if P(x)]
Someone, please also contribute a fixer for 2to3 to do this.
It can leave map()/filter() calls alone that are already
inside a list() or sorted() call or for-loop.
Only in rare cases have I seen code that depends on map() of lists
of different lengths going to the end of the longest, or on filter()
of a string or tuple returning an object of the same type; these
will need more thought to fix.
........
r56136 | guido.van.rossum | 2007-07-01 06:22:01 +0200 (Sun, 01 Jul 2007) | 3 lines
Make it so that test_decimal fails instead of hangs, to help automated
test runners.
........
r56139 | georg.brandl | 2007-07-01 18:20:58 +0200 (Sun, 01 Jul 2007) | 2 lines
Fix a few test cases after the map->imap change.
........
r56142 | neal.norwitz | 2007-07-02 06:38:12 +0200 (Mon, 02 Jul 2007) | 1 line
Get a bunch more tests passing after converting map/filter to return iterators.
........
r56147 | guido.van.rossum | 2007-07-02 15:32:02 +0200 (Mon, 02 Jul 2007) | 4 lines
Fix the remaining failing unit tests (at least on OSX).
Also tweaked urllib2 so it doesn't raise socket.gaierror when
all network interfaces are turned off.
........
2007-07-03 05:25:58 -03:00
|
|
|
special = [0, 1, 2, BASE, BASE >> 1, 0x5555555555555555, 0xaaaaaaaaaaaaaaaa]
|
1998-10-01 22:19:48 -03:00
|
|
|
# some solid strings of one bits
|
2007-01-15 12:59:06 -04:00
|
|
|
p2 = 4 # 0 and 1 already added
|
1998-10-01 22:19:48 -03:00
|
|
|
for i in range(2*SHIFT):
|
|
|
|
special.append(p2 - 1)
|
|
|
|
p2 = p2 << 1
|
|
|
|
del p2
|
|
|
|
# add complements & negations
|
Merged revisions 56125-56153 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
........
r56127 | georg.brandl | 2007-06-30 09:32:49 +0200 (Sat, 30 Jun 2007) | 2 lines
Fix a place where floor division would be in order.
........
r56135 | guido.van.rossum | 2007-07-01 06:13:54 +0200 (Sun, 01 Jul 2007) | 28 lines
Make map() and filter() identical to itertools.imap() and .ifilter(),
respectively.
I fixed two bootstrap issues, due to the dynamic import of itertools:
1. Starting python requires that map() and filter() are not used until
site.py has added build/lib.<arch> to sys.path.
2. Building python requires that setup.py and distutils and everything
they use is free of map() and filter() calls.
Beyond this, I only fixed the tests in test_builtin.py.
Others, please help fixing the remaining tests that are now broken!
The fixes are usually simple:
a. map(None, X) -> list(X)
b. map(F, X) -> list(map(F, X))
c. map(lambda x: F(x), X) -> [F(x) for x in X]
d. filter(F, X) -> list(filter(F, X))
e. filter(lambda x: P(x), X) -> [x for x in X if P(x)]
Someone, please also contribute a fixer for 2to3 to do this.
It can leave map()/filter() calls alone that are already
inside a list() or sorted() call or for-loop.
Only in rare cases have I seen code that depends on map() of lists
of different lengths going to the end of the longest, or on filter()
of a string or tuple returning an object of the same type; these
will need more thought to fix.
........
r56136 | guido.van.rossum | 2007-07-01 06:22:01 +0200 (Sun, 01 Jul 2007) | 3 lines
Make it so that test_decimal fails instead of hangs, to help automated
test runners.
........
r56139 | georg.brandl | 2007-07-01 18:20:58 +0200 (Sun, 01 Jul 2007) | 2 lines
Fix a few test cases after the map->imap change.
........
r56142 | neal.norwitz | 2007-07-02 06:38:12 +0200 (Mon, 02 Jul 2007) | 1 line
Get a bunch more tests passing after converting map/filter to return iterators.
........
r56147 | guido.van.rossum | 2007-07-02 15:32:02 +0200 (Mon, 02 Jul 2007) | 4 lines
Fix the remaining failing unit tests (at least on OSX).
Also tweaked urllib2 so it doesn't raise socket.gaierror when
all network interfaces are turned off.
........
2007-07-03 05:25:58 -03:00
|
|
|
special += [~x for x in special] + [-x for x in special]
|
1998-10-01 22:19:48 -03:00
|
|
|
|
2009-12-27 11:09:50 -04:00
|
|
|
DBL_MAX = sys.float_info.max
|
|
|
|
DBL_MAX_EXP = sys.float_info.max_exp
|
|
|
|
DBL_MIN_EXP = sys.float_info.min_exp
|
|
|
|
DBL_MANT_DIG = sys.float_info.mant_dig
|
|
|
|
DBL_MIN_OVERFLOW = 2**DBL_MAX_EXP - 2**(DBL_MAX_EXP - DBL_MANT_DIG - 1)
|
|
|
|
|
2011-10-23 16:07:13 -03:00
|
|
|
|
|
|
|
# Pure Python version of correctly-rounded integer-to-float conversion.
|
|
|
|
def int_to_float(n):
|
|
|
|
"""
|
|
|
|
Correctly-rounded integer-to-float conversion.
|
|
|
|
|
|
|
|
"""
|
|
|
|
# Constants, depending only on the floating-point format in use.
|
|
|
|
# We use an extra 2 bits of precision for rounding purposes.
|
|
|
|
PRECISION = sys.float_info.mant_dig + 2
|
|
|
|
SHIFT_MAX = sys.float_info.max_exp - PRECISION
|
|
|
|
Q_MAX = 1 << PRECISION
|
|
|
|
ROUND_HALF_TO_EVEN_CORRECTION = [0, -1, -2, 1, 0, -1, 2, 1]
|
|
|
|
|
|
|
|
# Reduce to the case where n is positive.
|
|
|
|
if n == 0:
|
|
|
|
return 0.0
|
|
|
|
elif n < 0:
|
|
|
|
return -int_to_float(-n)
|
|
|
|
|
|
|
|
# Convert n to a 'floating-point' number q * 2**shift, where q is an
|
|
|
|
# integer with 'PRECISION' significant bits. When shifting n to create q,
|
|
|
|
# the least significant bit of q is treated as 'sticky'. That is, the
|
|
|
|
# least significant bit of q is set if either the corresponding bit of n
|
|
|
|
# was already set, or any one of the bits of n lost in the shift was set.
|
|
|
|
shift = n.bit_length() - PRECISION
|
|
|
|
q = n << -shift if shift < 0 else (n >> shift) | bool(n & ~(-1 << shift))
|
|
|
|
|
|
|
|
# Round half to even (actually rounds to the nearest multiple of 4,
|
|
|
|
# rounding ties to a multiple of 8).
|
|
|
|
q += ROUND_HALF_TO_EVEN_CORRECTION[q & 7]
|
|
|
|
|
|
|
|
# Detect overflow.
|
|
|
|
if shift + (q == Q_MAX) > SHIFT_MAX:
|
|
|
|
raise OverflowError("integer too large to convert to float")
|
|
|
|
|
|
|
|
# Checks: q is exactly representable, and q**2**shift doesn't overflow.
|
|
|
|
assert q % 4 == 0 and q // 4 <= 2**(sys.float_info.mant_dig)
|
|
|
|
assert q * 2**shift <= sys.float_info.max
|
|
|
|
|
|
|
|
# Some circularity here, since float(q) is doing an int-to-float
|
|
|
|
# conversion. But here q is of bounded size, and is exactly representable
|
|
|
|
# as a float. In a low-level C-like language, this operation would be a
|
|
|
|
# simple cast (e.g., from unsigned long long to double).
|
|
|
|
return math.ldexp(float(q), shift)
|
|
|
|
|
|
|
|
|
2009-12-27 11:09:50 -04:00
|
|
|
# pure Python version of correctly-rounded true division
|
|
|
|
def truediv(a, b):
|
|
|
|
"""Correctly-rounded true division for integers."""
|
|
|
|
negative = a^b < 0
|
|
|
|
a, b = abs(a), abs(b)
|
|
|
|
|
|
|
|
# exceptions: division by zero, overflow
|
|
|
|
if not b:
|
|
|
|
raise ZeroDivisionError("division by zero")
|
|
|
|
if a >= DBL_MIN_OVERFLOW * b:
|
|
|
|
raise OverflowError("int/int too large to represent as a float")
|
|
|
|
|
|
|
|
# find integer d satisfying 2**(d - 1) <= a/b < 2**d
|
|
|
|
d = a.bit_length() - b.bit_length()
|
|
|
|
if d >= 0 and a >= 2**d * b or d < 0 and a * 2**-d >= b:
|
|
|
|
d += 1
|
|
|
|
|
|
|
|
# compute 2**-exp * a / b for suitable exp
|
|
|
|
exp = max(d, DBL_MIN_EXP) - DBL_MANT_DIG
|
|
|
|
a, b = a << max(-exp, 0), b << max(exp, 0)
|
|
|
|
q, r = divmod(a, b)
|
|
|
|
|
|
|
|
# round-half-to-even: fractional part is r/b, which is > 0.5 iff
|
|
|
|
# 2*r > b, and == 0.5 iff 2*r == b.
|
|
|
|
if 2*r > b or 2*r == b and q % 2 == 1:
|
|
|
|
q += 1
|
|
|
|
|
2009-12-27 15:03:31 -04:00
|
|
|
result = math.ldexp(q, exp)
|
2009-12-27 11:09:50 -04:00
|
|
|
return -result if negative else result
|
|
|
|
|
|
|
|
|
2005-06-13 18:44:48 -03:00
|
|
|
class LongTest(unittest.TestCase):
|
|
|
|
|
|
|
|
# Get quasi-random long consisting of ndigits digits (in base BASE).
|
|
|
|
# quasi == the most-significant digit will not be 0, and the number
|
|
|
|
# is constructed to contain long strings of 0 and 1 bits. These are
|
|
|
|
# more likely than random bits to provoke digit-boundary errors.
|
|
|
|
# The sign of the number is also random.
|
|
|
|
|
|
|
|
def getran(self, ndigits):
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertGreater(ndigits, 0)
|
2005-06-13 18:44:48 -03:00
|
|
|
nbits_hi = ndigits * SHIFT
|
|
|
|
nbits_lo = nbits_hi - SHIFT + 1
|
2007-01-15 12:59:06 -04:00
|
|
|
answer = 0
|
2005-06-13 18:44:48 -03:00
|
|
|
nbits = 0
|
|
|
|
r = int(random.random() * (SHIFT * 2)) | 1 # force 1 bits to start
|
|
|
|
while nbits < nbits_lo:
|
|
|
|
bits = (r >> 1) + 1
|
|
|
|
bits = min(bits, nbits_hi - nbits)
|
2009-06-30 20:06:06 -03:00
|
|
|
self.assertTrue(1 <= bits <= SHIFT)
|
2005-06-13 18:44:48 -03:00
|
|
|
nbits = nbits + bits
|
|
|
|
answer = answer << bits
|
|
|
|
if r & 1:
|
|
|
|
answer = answer | ((1 << bits) - 1)
|
|
|
|
r = int(random.random() * (SHIFT * 2))
|
2009-06-30 20:06:06 -03:00
|
|
|
self.assertTrue(nbits_lo <= nbits <= nbits_hi)
|
2005-06-13 18:44:48 -03:00
|
|
|
if random.random() < 0.5:
|
|
|
|
answer = -answer
|
|
|
|
return answer
|
|
|
|
|
|
|
|
# Get random long consisting of ndigits random digits (relative to base
|
|
|
|
# BASE). The sign bit is also random.
|
|
|
|
|
|
|
|
def getran2(ndigits):
|
2007-01-15 12:59:06 -04:00
|
|
|
answer = 0
|
2007-05-07 19:24:25 -03:00
|
|
|
for i in range(ndigits):
|
2005-06-13 18:44:48 -03:00
|
|
|
answer = (answer << SHIFT) | random.randint(0, MASK)
|
|
|
|
if random.random() < 0.5:
|
|
|
|
answer = -answer
|
|
|
|
return answer
|
|
|
|
|
|
|
|
def check_division(self, x, y):
|
|
|
|
eq = self.assertEqual
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(x=x, y=y):
|
|
|
|
q, r = divmod(x, y)
|
|
|
|
q2, r2 = x//y, x%y
|
|
|
|
pab, pba = x*y, y*x
|
|
|
|
eq(pab, pba, "multiplication does not commute")
|
|
|
|
eq(q, q2, "divmod returns different quotient than /")
|
|
|
|
eq(r, r2, "divmod returns different mod than %")
|
|
|
|
eq(x, q*y + r, "x != q*y + r after divmod")
|
|
|
|
if y > 0:
|
|
|
|
self.assertTrue(0 <= r < y, "bad mod from divmod")
|
|
|
|
else:
|
|
|
|
self.assertTrue(y < r <= 0, "bad mod from divmod")
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def test_division(self):
|
2007-05-07 19:24:25 -03:00
|
|
|
digits = list(range(1, MAXDIGITS+1)) + list(range(KARATSUBA_CUTOFF,
|
|
|
|
KARATSUBA_CUTOFF + 14))
|
2005-06-13 18:44:48 -03:00
|
|
|
digits.append(KARATSUBA_CUTOFF * 3)
|
|
|
|
for lenx in digits:
|
|
|
|
x = self.getran(lenx)
|
|
|
|
for leny in digits:
|
2007-01-15 12:59:06 -04:00
|
|
|
y = self.getran(leny) or 1
|
2005-06-13 18:44:48 -03:00
|
|
|
self.check_division(x, y)
|
|
|
|
|
2009-03-18 17:06:12 -03:00
|
|
|
# specific numbers chosen to exercise corner cases of the
|
|
|
|
# current long division implementation
|
|
|
|
|
|
|
|
# 30-bit cases involving a quotient digit estimate of BASE+1
|
|
|
|
self.check_division(1231948412290879395966702881,
|
|
|
|
1147341367131428698)
|
|
|
|
self.check_division(815427756481275430342312021515587883,
|
|
|
|
707270836069027745)
|
|
|
|
self.check_division(627976073697012820849443363563599041,
|
|
|
|
643588798496057020)
|
|
|
|
self.check_division(1115141373653752303710932756325578065,
|
|
|
|
1038556335171453937726882627)
|
|
|
|
# 30-bit cases that require the post-subtraction correction step
|
|
|
|
self.check_division(922498905405436751940989320930368494,
|
|
|
|
949985870686786135626943396)
|
|
|
|
self.check_division(768235853328091167204009652174031844,
|
|
|
|
1091555541180371554426545266)
|
|
|
|
|
|
|
|
# 15-bit cases involving a quotient digit estimate of BASE+1
|
|
|
|
self.check_division(20172188947443, 615611397)
|
|
|
|
self.check_division(1020908530270155025, 950795710)
|
|
|
|
self.check_division(128589565723112408, 736393718)
|
|
|
|
self.check_division(609919780285761575, 18613274546784)
|
|
|
|
# 15-bit cases that require the post-subtraction correction step
|
|
|
|
self.check_division(710031681576388032, 26769404391308)
|
|
|
|
self.check_division(1933622614268221, 30212853348836)
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-13 18:44:48 -03:00
|
|
|
def test_karatsuba(self):
|
2007-05-07 19:24:25 -03:00
|
|
|
digits = list(range(1, 5)) + list(range(KARATSUBA_CUTOFF,
|
|
|
|
KARATSUBA_CUTOFF + 10))
|
2005-06-13 18:44:48 -03:00
|
|
|
digits.extend([KARATSUBA_CUTOFF * 10, KARATSUBA_CUTOFF * 100])
|
|
|
|
|
|
|
|
bits = [digit * SHIFT for digit in digits]
|
|
|
|
|
|
|
|
# Test products of long strings of 1 bits -- (2**x-1)*(2**y-1) ==
|
|
|
|
# 2**(x+y) - 2**x - 2**y + 1, so the proper result is easy to check.
|
|
|
|
for abits in bits:
|
2007-01-15 12:59:06 -04:00
|
|
|
a = (1 << abits) - 1
|
2005-06-13 18:44:48 -03:00
|
|
|
for bbits in bits:
|
|
|
|
if bbits < abits:
|
|
|
|
continue
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(abits=abits, bbits=bbits):
|
|
|
|
b = (1 << bbits) - 1
|
|
|
|
x = a * b
|
|
|
|
y = ((1 << (abits + bbits)) -
|
|
|
|
(1 << abits) -
|
|
|
|
(1 << bbits) +
|
|
|
|
1)
|
|
|
|
self.assertEqual(x, y)
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def check_bitop_identities_1(self, x):
|
|
|
|
eq = self.assertEqual
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(x=x):
|
|
|
|
eq(x & 0, 0)
|
|
|
|
eq(x | 0, x)
|
|
|
|
eq(x ^ 0, x)
|
|
|
|
eq(x & -1, x)
|
|
|
|
eq(x | -1, -1)
|
|
|
|
eq(x ^ -1, ~x)
|
|
|
|
eq(x, ~~x)
|
|
|
|
eq(x & x, x)
|
|
|
|
eq(x | x, x)
|
|
|
|
eq(x ^ x, 0)
|
|
|
|
eq(x & ~x, 0)
|
|
|
|
eq(x | ~x, -1)
|
|
|
|
eq(x ^ ~x, -1)
|
|
|
|
eq(-x, 1 + ~x)
|
|
|
|
eq(-x, ~(x-1))
|
2007-05-07 19:24:25 -03:00
|
|
|
for n in range(2*SHIFT):
|
2007-01-15 12:59:06 -04:00
|
|
|
p2 = 2 ** n
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(x=x, n=n, p2=p2):
|
|
|
|
eq(x << n >> n, x)
|
|
|
|
eq(x // p2, x >> n)
|
|
|
|
eq(x * p2, x << n)
|
|
|
|
eq(x & -p2, x >> n << n)
|
|
|
|
eq(x & -p2, x & ~(p2 - 1))
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def check_bitop_identities_2(self, x, y):
|
|
|
|
eq = self.assertEqual
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(x=x, y=y):
|
|
|
|
eq(x & y, y & x)
|
|
|
|
eq(x | y, y | x)
|
|
|
|
eq(x ^ y, y ^ x)
|
|
|
|
eq(x ^ y ^ x, y)
|
|
|
|
eq(x & y, ~(~x | ~y))
|
|
|
|
eq(x | y, ~(~x & ~y))
|
|
|
|
eq(x ^ y, (x | y) & ~(x & y))
|
|
|
|
eq(x ^ y, (x & ~y) | (~x & y))
|
|
|
|
eq(x ^ y, (x | y) & (~x | ~y))
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def check_bitop_identities_3(self, x, y, z):
|
|
|
|
eq = self.assertEqual
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(x=x, y=y, z=z):
|
|
|
|
eq((x & y) & z, x & (y & z))
|
|
|
|
eq((x | y) | z, x | (y | z))
|
|
|
|
eq((x ^ y) ^ z, x ^ (y ^ z))
|
|
|
|
eq(x & (y | z), (x & y) | (x & z))
|
|
|
|
eq(x | (y & z), (x | y) & (x | z))
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def test_bitop_identities(self):
|
|
|
|
for x in special:
|
|
|
|
self.check_bitop_identities_1(x)
|
2007-05-07 19:24:25 -03:00
|
|
|
digits = range(1, MAXDIGITS+1)
|
2005-06-13 18:44:48 -03:00
|
|
|
for lenx in digits:
|
|
|
|
x = self.getran(lenx)
|
|
|
|
self.check_bitop_identities_1(x)
|
|
|
|
for leny in digits:
|
|
|
|
y = self.getran(leny)
|
|
|
|
self.check_bitop_identities_2(x, y)
|
|
|
|
self.check_bitop_identities_3(x, y, self.getran((lenx + leny)//2))
|
|
|
|
|
|
|
|
def slow_format(self, x, base):
|
|
|
|
digits = []
|
|
|
|
sign = 0
|
|
|
|
if x < 0:
|
|
|
|
sign, x = 1, -x
|
|
|
|
while x:
|
|
|
|
x, r = divmod(x, base)
|
|
|
|
digits.append(int(r))
|
|
|
|
digits.reverse()
|
|
|
|
digits = digits or [0]
|
|
|
|
return '-'[:sign] + \
|
Merged revisions 55817-55961 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk
................
r55837 | guido.van.rossum | 2007-06-08 16:04:42 -0700 (Fri, 08 Jun 2007) | 2 lines
PEP 3119 -- the abc module.
................
r55838 | guido.van.rossum | 2007-06-08 17:38:55 -0700 (Fri, 08 Jun 2007) | 2 lines
Implement part of PEP 3119 -- One Trick Ponies.
................
r55847 | guido.van.rossum | 2007-06-09 08:28:06 -0700 (Sat, 09 Jun 2007) | 2 lines
Different way to do one trick ponies, allowing registration (per PEP strawman).
................
r55849 | guido.van.rossum | 2007-06-09 18:06:38 -0700 (Sat, 09 Jun 2007) | 3 lines
Make sure that the magic looking for __hash__ (etc.) doesn't apply to
real subclasses of Hashable.
................
r55852 | guido.van.rossum | 2007-06-10 08:29:51 -0700 (Sun, 10 Jun 2007) | 2 lines
Add some more examples, e.g. generators and dict views.
................
r55853 | guido.van.rossum | 2007-06-10 08:31:59 -0700 (Sun, 10 Jun 2007) | 2 lines
keys() and items() *are* containers -- just values() isn't.
................
r55864 | georg.brandl | 2007-06-10 15:29:40 -0700 (Sun, 10 Jun 2007) | 2 lines
PEP 3127: new octal literals, binary literals.
................
r55865 | georg.brandl | 2007-06-10 15:31:37 -0700 (Sun, 10 Jun 2007) | 2 lines
Some octal literal fixes in Tools.
................
r55866 | georg.brandl | 2007-06-10 15:37:43 -0700 (Sun, 10 Jun 2007) | 2 lines
Tokenizer changes for PEP 3127.
................
r55867 | georg.brandl | 2007-06-10 15:37:55 -0700 (Sun, 10 Jun 2007) | 2 lines
Some docs for PEP 3127.
................
r55868 | georg.brandl | 2007-06-10 15:44:39 -0700 (Sun, 10 Jun 2007) | 2 lines
Missed a place in intobject.c. Is that used anymore anyway?
................
r55871 | neal.norwitz | 2007-06-10 18:31:49 -0700 (Sun, 10 Jun 2007) | 182 lines
Merged revisions 55729-55868 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55731 | neal.norwitz | 2007-06-01 00:29:12 -0700 (Fri, 01 Jun 2007) | 7 lines
SF 1668596/1720897: distutils now copies data files
even if package_dir is empty.
This needs to be backported. I'm too tired tonight. It would be great
if someone backports this if the buildbots are ok with it. Otherwise,
I will try to get to it tomorrow.
........
r55732 | georg.brandl | 2007-06-01 04:33:33 -0700 (Fri, 01 Jun 2007) | 2 lines
Bug #1722484: remove docstrings again when running with -OO.
........
r55735 | georg.brandl | 2007-06-01 12:20:27 -0700 (Fri, 01 Jun 2007) | 2 lines
Fix wrong issue number.
........
r55739 | brett.cannon | 2007-06-01 20:02:29 -0700 (Fri, 01 Jun 2007) | 3 lines
Have configure raise an error when building on AtheOS. Code specific to AtheOS
will be removed in Python 2.7.
........
r55746 | neal.norwitz | 2007-06-02 11:33:53 -0700 (Sat, 02 Jun 2007) | 1 line
Update expected birthday of 2.6
........
r55751 | neal.norwitz | 2007-06-03 13:32:50 -0700 (Sun, 03 Jun 2007) | 10 lines
Backout the original 'fix' to 1721309 which had no effect.
Different versions of Berkeley DB handle this differently.
The comments and bug report should have the details. Memory is allocated
in 4.4 (and presumably earlier), but not in 4.5. Thus
4.5 has the free error, but not earlier versions.
Mostly update comments, plus make the free conditional.
This fix was already applied to the 2.5 branch.
........
r55752 | brett.cannon | 2007-06-03 16:13:41 -0700 (Sun, 03 Jun 2007) | 6 lines
Make _strptime.TimeRE().pattern() use ``\s+`` for matching whitespace instead
of ``\s*``. This prevents patterns from "stealing" bits from other patterns in
order to make a match work.
Closes bug #1730389. Will be backported.
........
r55766 | hyeshik.chang | 2007-06-05 11:16:52 -0700 (Tue, 05 Jun 2007) | 4 lines
Fix build on FreeBSD. Bluetooth HCI API in FreeBSD is quite different
from Linux's. Just fix the build for now but the code doesn't
support the complete capability of HCI on FreeBSD yet.
........
r55770 | hyeshik.chang | 2007-06-05 11:58:51 -0700 (Tue, 05 Jun 2007) | 4 lines
Bug #1728403: Fix a bug that CJKCodecs StreamReader hangs when it
reads a file that ends with incomplete sequence and sizehint argument
for .read() is specified.
........
r55775 | hyeshik.chang | 2007-06-05 12:28:15 -0700 (Tue, 05 Jun 2007) | 2 lines
Fix for Windows: close a temporary file before trying to delete it.
........
r55783 | guido.van.rossum | 2007-06-05 14:24:47 -0700 (Tue, 05 Jun 2007) | 2 lines
Patch by Tim Delany (missing DECREF). SF #1731330.
........
r55785 | collin.winter | 2007-06-05 17:17:35 -0700 (Tue, 05 Jun 2007) | 3 lines
Patch #1731049: make threading.py use a proper "raise" when checking internal state, rather than assert statements (which get stripped out by -O).
........
r55786 | facundo.batista | 2007-06-06 08:13:37 -0700 (Wed, 06 Jun 2007) | 4 lines
FTP.ntransfercmd method now uses create_connection when passive,
using the timeout received in connection time.
........
r55792 | facundo.batista | 2007-06-06 10:15:23 -0700 (Wed, 06 Jun 2007) | 7 lines
Added an optional timeout parameter to function urllib2.urlopen,
with tests in test_urllib2net.py (must have network resource
enabled to execute them). Also modified test_urllib2.py because
testing mock classes must take it into acount. Docs are also
updated.
........
r55793 | thomas.heller | 2007-06-06 13:19:19 -0700 (Wed, 06 Jun 2007) | 1 line
Build _ctypes and _ctypes_test in the ReleaseAMD64 configuration.
........
r55802 | georg.brandl | 2007-06-07 06:23:24 -0700 (Thu, 07 Jun 2007) | 3 lines
Disallow function calls like foo(None=1).
Backport from py3k rev. 55708 by Guido.
........
r55804 | georg.brandl | 2007-06-07 06:30:24 -0700 (Thu, 07 Jun 2007) | 2 lines
Make reindent.py executable.
........
r55805 | georg.brandl | 2007-06-07 06:34:10 -0700 (Thu, 07 Jun 2007) | 2 lines
Patch #1667860: Fix UnboundLocalError in urllib2.
........
r55821 | kristjan.jonsson | 2007-06-07 16:53:49 -0700 (Thu, 07 Jun 2007) | 1 line
Fixing changes to getbuildinfo.c that broke linux builds
........
r55828 | thomas.heller | 2007-06-08 09:10:27 -0700 (Fri, 08 Jun 2007) | 1 line
Make this test work with older Python releases where struct has no 't' format character.
........
r55829 | martin.v.loewis | 2007-06-08 10:29:20 -0700 (Fri, 08 Jun 2007) | 3 lines
Bug #1733488: Fix compilation of bufferobject.c on AIX.
Will backport to 2.5.
........
r55831 | thomas.heller | 2007-06-08 11:20:09 -0700 (Fri, 08 Jun 2007) | 2 lines
[ 1715718 ] x64 clean compile patch for _ctypes, by Kristj?n Valur
with small modifications.
........
r55832 | thomas.heller | 2007-06-08 12:01:06 -0700 (Fri, 08 Jun 2007) | 1 line
Fix gcc warnings intruduced by passing Py_ssize_t to PyErr_Format calls.
........
r55833 | thomas.heller | 2007-06-08 12:08:31 -0700 (Fri, 08 Jun 2007) | 2 lines
Fix wrong documentation, and correct the punktuation.
Closes [1700455].
........
r55834 | thomas.heller | 2007-06-08 12:14:23 -0700 (Fri, 08 Jun 2007) | 1 line
Fix warnings by using proper function prototype.
........
r55839 | neal.norwitz | 2007-06-08 20:36:34 -0700 (Fri, 08 Jun 2007) | 7 lines
Prevent expandtabs() on string and unicode objects from causing a segfault when
a large width is passed on 32-bit platforms. Found by Google.
It would be good for people to review this especially carefully and verify
I don't have an off by one error and there is no other way to cause overflow.
........
r55841 | neal.norwitz | 2007-06-08 21:48:22 -0700 (Fri, 08 Jun 2007) | 1 line
Use macro version of GET_SIZE to avoid Coverity warning (#150) about a possible error.
........
r55842 | martin.v.loewis | 2007-06-09 00:42:52 -0700 (Sat, 09 Jun 2007) | 3 lines
Patch #1733960: Allow T_LONGLONG to accept ints.
Will backport to 2.5.
........
r55843 | martin.v.loewis | 2007-06-09 00:58:05 -0700 (Sat, 09 Jun 2007) | 2 lines
Fix Windows build.
........
r55845 | martin.v.loewis | 2007-06-09 03:10:26 -0700 (Sat, 09 Jun 2007) | 2 lines
Provide LLONG_MAX for S390.
........
r55854 | thomas.heller | 2007-06-10 08:59:17 -0700 (Sun, 10 Jun 2007) | 4 lines
First version of build scripts for Windows/AMD64 (no external
components are built yet, and 'kill_python' is disabled).
........
r55855 | thomas.heller | 2007-06-10 10:55:51 -0700 (Sun, 10 Jun 2007) | 3 lines
For now, disable the _bsddb, _sqlite3, _ssl, _testcapi, _tkinter
modules in the ReleaseAMD64 configuration because they do not compile.
........
r55856 | thomas.heller | 2007-06-10 11:27:54 -0700 (Sun, 10 Jun 2007) | 1 line
Need to set the environment variables, otherwise devenv.com is not found.
........
r55860 | thomas.heller | 2007-06-10 14:01:17 -0700 (Sun, 10 Jun 2007) | 1 line
Revert commit 55855.
........
................
r55880 | neal.norwitz | 2007-06-10 22:07:36 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix the refleak counter on test_collections. The ABC metaclass creates
a registry which must be cleared on each run. Otherwise, there *seem*
to be refleaks when there really aren't any. (The class is held within
the registry even though it's no longer needed.)
................
r55884 | neal.norwitz | 2007-06-10 22:46:33 -0700 (Sun, 10 Jun 2007) | 1 line
These tests have been removed, so they are no longer needed here
................
r55886 | georg.brandl | 2007-06-11 00:26:37 -0700 (Mon, 11 Jun 2007) | 3 lines
Optimize access to True and False in the compiler (if True)
and the peepholer (LOAD_NAME True).
................
r55905 | georg.brandl | 2007-06-11 10:02:26 -0700 (Mon, 11 Jun 2007) | 5 lines
Remove __oct__ and __hex__ and use __index__ for converting
non-ints before formatting in a base.
Add a bin() builtin.
................
r55906 | georg.brandl | 2007-06-11 10:04:44 -0700 (Mon, 11 Jun 2007) | 2 lines
int(x, 0) does not "guess".
................
r55907 | georg.brandl | 2007-06-11 10:05:47 -0700 (Mon, 11 Jun 2007) | 2 lines
Add a comment to explain that nb_oct and nb_hex are nonfunctional.
................
r55908 | guido.van.rossum | 2007-06-11 10:49:18 -0700 (Mon, 11 Jun 2007) | 2 lines
Get rid of unused imports and comment.
................
r55910 | guido.van.rossum | 2007-06-11 13:05:17 -0700 (Mon, 11 Jun 2007) | 2 lines
_Abstract.__new__ now requires either no arguments or __init__ overridden.
................
r55911 | guido.van.rossum | 2007-06-11 13:07:49 -0700 (Mon, 11 Jun 2007) | 7 lines
Move the collections ABCs to a separate file, _abcoll.py, in order to avoid
needing to import _collections.so during the bootstrap (this will become
apparent in the next submit of os.py).
Add (plain and mutable) ABCs for Set, Mapping, Sequence.
................
r55912 | guido.van.rossum | 2007-06-11 13:09:31 -0700 (Mon, 11 Jun 2007) | 2 lines
Rewrite the _Environ class to use the new collections ABCs.
................
r55913 | guido.van.rossum | 2007-06-11 13:59:45 -0700 (Mon, 11 Jun 2007) | 72 lines
Merged revisions 55869-55912 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55869 | neal.norwitz | 2007-06-10 17:42:11 -0700 (Sun, 10 Jun 2007) | 1 line
Add Atul Varma for patch # 1667860
........
r55870 | neal.norwitz | 2007-06-10 18:22:03 -0700 (Sun, 10 Jun 2007) | 1 line
Ignore valgrind problems on Ubuntu from ld
........
r55872 | neal.norwitz | 2007-06-10 18:48:46 -0700 (Sun, 10 Jun 2007) | 2 lines
Ignore config.status.lineno which seems new (new autoconf?)
........
r55873 | neal.norwitz | 2007-06-10 19:14:39 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent these tests from running on Win64 since they don\'t apply there either
........
r55874 | neal.norwitz | 2007-06-10 19:16:10 -0700 (Sun, 10 Jun 2007) | 5 lines
Fix a bug when there was a newline in the string expandtabs was called on.
This also catches another condition that can overflow.
Will backport.
........
r55879 | neal.norwitz | 2007-06-10 21:52:37 -0700 (Sun, 10 Jun 2007) | 1 line
Prevent hang if the port cannot be opened.
........
r55881 | neal.norwitz | 2007-06-10 22:28:45 -0700 (Sun, 10 Jun 2007) | 4 lines
Add all of the distuils modules that don't seem to have explicit tests. :-(
Move an import in mworkscompiler so that this module can be imported on
any platform. Hopefully this works on all platforms.
........
r55882 | neal.norwitz | 2007-06-10 22:35:10 -0700 (Sun, 10 Jun 2007) | 4 lines
SF #1734732, lower case the module names per PEP 8.
Will backport.
........
r55885 | neal.norwitz | 2007-06-10 23:16:48 -0700 (Sun, 10 Jun 2007) | 4 lines
Not sure why this only fails sometimes on Unix machines. Better
to disable it and only import msvccompiler on Windows since that's
the only place it can work anyways.
........
r55887 | neal.norwitz | 2007-06-11 00:29:43 -0700 (Mon, 11 Jun 2007) | 4 lines
Bug #1734723: Fix repr.Repr() so it doesn't ignore the maxtuple attribute.
Will backport
........
r55889 | neal.norwitz | 2007-06-11 00:36:24 -0700 (Mon, 11 Jun 2007) | 1 line
Reflow long line
........
r55896 | thomas.heller | 2007-06-11 08:58:33 -0700 (Mon, 11 Jun 2007) | 3 lines
Use "O&" in calls to PyArg_Parse when we need a 'void*' instead of "k"
or "K" codes.
........
r55901 | facundo.batista | 2007-06-11 09:27:08 -0700 (Mon, 11 Jun 2007) | 5 lines
Added versionchanged flag to all the methods which received
a new optional timeout parameter, and a versionadded flag to
the socket.create_connection function.
........
................
r55914 | guido.van.rossum | 2007-06-11 14:19:50 -0700 (Mon, 11 Jun 2007) | 3 lines
New super() implementation, for PEP 3135 (though the PEP is not yet updated
to this design, and small tweaks may still be made later).
................
r55923 | guido.van.rossum | 2007-06-11 21:15:24 -0700 (Mon, 11 Jun 2007) | 4 lines
I'm guessing this module broke when Neal ripped out the types module --
it used 'list' both as a local variable and as the built-in list type.
Renamed the local variable since that was easier.
................
r55924 | guido.van.rossum | 2007-06-11 21:20:05 -0700 (Mon, 11 Jun 2007) | 5 lines
Change all occurrences of super(<thisclass>, <firstarg>) to super().
Seems to have worked, all the tests still pass.
Exception: test_descr and test_descrtut, which have tons of these
and are there to test the various usages.
................
r55939 | collin.winter | 2007-06-12 13:57:33 -0700 (Tue, 12 Jun 2007) | 1 line
Patch #1735485: remove StandardError from the exception hierarchy.
................
r55954 | neal.norwitz | 2007-06-12 21:56:32 -0700 (Tue, 12 Jun 2007) | 51 lines
Merged revisions 55913-55950 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r55926 | marc-andre.lemburg | 2007-06-12 02:09:58 -0700 (Tue, 12 Jun 2007) | 3 lines
Apply patch #1734945 to support TurboLinux as distribution.
........
r55927 | marc-andre.lemburg | 2007-06-12 02:26:49 -0700 (Tue, 12 Jun 2007) | 3 lines
Add patch #1726668: Windows Vista support.
........
r55929 | thomas.heller | 2007-06-12 08:36:22 -0700 (Tue, 12 Jun 2007) | 1 line
Checkout, but do not yet try to build, exernal sources.
........
r55930 | thomas.heller | 2007-06-12 09:08:27 -0700 (Tue, 12 Jun 2007) | 6 lines
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
Set the /XP64 /RETAIL build enviroment in the makefile when building
ReleaseAMD64.
........
r55931 | thomas.heller | 2007-06-12 09:23:19 -0700 (Tue, 12 Jun 2007) | 5 lines
Revert this change, since it breaks the win32 build:
Add bufferoverflowU.lib to the libraries needed by _ssl (is this the
right thing to do?).
........
r55934 | thomas.heller | 2007-06-12 10:28:31 -0700 (Tue, 12 Jun 2007) | 3 lines
Specify the bufferoverflowU.lib to the makefile on the command line
(for ReleaseAMD64 builds).
........
r55937 | thomas.heller | 2007-06-12 12:02:59 -0700 (Tue, 12 Jun 2007) | 3 lines
Add bufferoverflowU.lib to PCBuild\_bsddb.vcproj.
Build sqlite3.dll and bsddb.
........
r55938 | thomas.heller | 2007-06-12 12:56:12 -0700 (Tue, 12 Jun 2007) | 2 lines
Don't rebuild Berkeley DB if not needed (this was committed by accident).
........
r55948 | martin.v.loewis | 2007-06-12 20:42:19 -0700 (Tue, 12 Jun 2007) | 3 lines
Provide PY_LLONG_MAX on all systems having long long.
Will backport to 2.5.
........
................
r55959 | guido.van.rossum | 2007-06-13 09:22:41 -0700 (Wed, 13 Jun 2007) | 2 lines
Fix a compilation warning.
................
2007-06-13 15:07:49 -03:00
|
|
|
{2: '0b', 8: '0o', 10: '', 16: '0x'}[base] + \
|
2010-12-04 06:39:14 -04:00
|
|
|
"".join("0123456789abcdef"[i] for i in digits)
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def check_format_1(self, x):
|
2013-08-27 13:40:23 -03:00
|
|
|
for base, mapper in (2, bin), (8, oct), (10, str), (10, repr), (16, hex):
|
2005-06-13 18:44:48 -03:00
|
|
|
got = mapper(x)
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(x=x, mapper=mapper.__name__):
|
|
|
|
expected = self.slow_format(x, base)
|
|
|
|
self.assertEqual(got, expected)
|
|
|
|
with self.subTest(got=got):
|
|
|
|
self.assertEqual(int(got, 0), x)
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def test_format(self):
|
|
|
|
for x in special:
|
|
|
|
self.check_format_1(x)
|
2007-05-07 19:24:25 -03:00
|
|
|
for i in range(10):
|
|
|
|
for lenx in range(1, MAXDIGITS+1):
|
2005-06-13 18:44:48 -03:00
|
|
|
x = self.getran(lenx)
|
|
|
|
self.check_format_1(x)
|
|
|
|
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
def test_long(self):
|
2009-12-05 16:28:34 -04:00
|
|
|
# Check conversions from string
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
LL = [
|
|
|
|
('1' + '0'*20, 10**20),
|
|
|
|
('1' + '0'*100, 10**100)
|
|
|
|
]
|
2009-12-05 16:28:34 -04:00
|
|
|
for s, v in LL:
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
for sign in "", "+", "-":
|
|
|
|
for prefix in "", " ", "\t", " \t\t ":
|
|
|
|
ss = prefix + sign + s
|
|
|
|
vv = v
|
|
|
|
if sign == "-" and v is not ValueError:
|
|
|
|
vv = -v
|
|
|
|
try:
|
2009-12-05 16:28:34 -04:00
|
|
|
self.assertEqual(int(ss), vv)
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
except ValueError:
|
|
|
|
pass
|
|
|
|
|
2009-01-20 16:45:53 -04:00
|
|
|
# trailing L should no longer be accepted...
|
|
|
|
self.assertRaises(ValueError, int, '123L')
|
|
|
|
self.assertRaises(ValueError, int, '123l')
|
|
|
|
self.assertRaises(ValueError, int, '0L')
|
|
|
|
self.assertRaises(ValueError, int, '-37L')
|
|
|
|
self.assertRaises(ValueError, int, '0x32L', 16)
|
|
|
|
self.assertRaises(ValueError, int, '1L', 21)
|
|
|
|
# ... but it's just a normal digit if base >= 22
|
|
|
|
self.assertEqual(int('1L', 22), 43)
|
|
|
|
|
2010-05-26 16:14:01 -03:00
|
|
|
# tests with base 0
|
|
|
|
self.assertEqual(int('000', 0), 0)
|
|
|
|
self.assertEqual(int('0o123', 0), 83)
|
|
|
|
self.assertEqual(int('0x123', 0), 291)
|
|
|
|
self.assertEqual(int('0b100', 0), 4)
|
|
|
|
self.assertEqual(int(' 0O123 ', 0), 83)
|
|
|
|
self.assertEqual(int(' 0X123 ', 0), 291)
|
|
|
|
self.assertEqual(int(' 0B100 ', 0), 4)
|
|
|
|
self.assertEqual(int('0', 0), 0)
|
|
|
|
self.assertEqual(int('+0', 0), 0)
|
|
|
|
self.assertEqual(int('-0', 0), 0)
|
|
|
|
self.assertEqual(int('00', 0), 0)
|
|
|
|
self.assertRaises(ValueError, int, '08', 0)
|
|
|
|
self.assertRaises(ValueError, int, '-012395', 0)
|
|
|
|
|
2010-05-26 17:07:58 -03:00
|
|
|
# invalid bases
|
|
|
|
invalid_bases = [-909,
|
|
|
|
2**31-1, 2**31, -2**31, -2**31-1,
|
|
|
|
2**63-1, 2**63, -2**63, -2**63-1,
|
|
|
|
2**100, -2**100,
|
|
|
|
]
|
|
|
|
for base in invalid_bases:
|
|
|
|
self.assertRaises(ValueError, int, '42', base)
|
|
|
|
|
2018-07-14 00:06:43 -03:00
|
|
|
# Invalid unicode string
|
|
|
|
# See bpo-34087
|
|
|
|
self.assertRaises(ValueError, int, '\u3053\u3093\u306b\u3061\u306f')
|
|
|
|
|
2010-05-26 17:07:58 -03:00
|
|
|
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
def test_conversion(self):
|
|
|
|
|
2009-12-05 16:28:34 -04:00
|
|
|
class JustLong:
|
|
|
|
# test that __long__ no longer used in 3.x
|
|
|
|
def __long__(self):
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
return 42
|
2009-12-05 16:28:34 -04:00
|
|
|
self.assertRaises(TypeError, int, JustLong())
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
|
2009-12-05 16:28:34 -04:00
|
|
|
class LongTrunc:
|
|
|
|
# __long__ should be ignored in 3.x
|
|
|
|
def __long__(self):
|
Merged revisions 62425-62429,62434-62436,62441,62444,62446-62448,62450-62455,62463,62465-62466,62469,62474,62476-62478,62480,62485,62492,62497-62498,62500,62507,62513-62514,62516,62521,62531,62535,62545-62546,62548-62551,62553-62559,62569,62574,62577,62593,62595,62604-62606,62608,62616,62626-62627,62636,62638,62644-62645,62647-62648,62651-62653,62656,62661,62663,62680,62686-62687,62696,62699-62703,62711 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
................
r62425 | andrew.kuchling | 2008-04-21 03:45:57 +0200 (Mon, 21 Apr 2008) | 1 line
Comment typo
................
r62426 | mark.dickinson | 2008-04-21 03:55:50 +0200 (Mon, 21 Apr 2008) | 2 lines
Silence 'r may be used uninitialized' compiler warning.
................
r62427 | andrew.kuchling | 2008-04-21 04:08:00 +0200 (Mon, 21 Apr 2008) | 1 line
Markup fix
................
r62428 | andrew.kuchling | 2008-04-21 04:08:13 +0200 (Mon, 21 Apr 2008) | 1 line
Wording changes
................
r62429 | andrew.kuchling | 2008-04-21 04:14:24 +0200 (Mon, 21 Apr 2008) | 1 line
Add various items
................
r62434 | thomas.heller | 2008-04-21 15:46:55 +0200 (Mon, 21 Apr 2008) | 1 line
Fix typo.
................
r62435 | david.goodger | 2008-04-21 16:40:22 +0200 (Mon, 21 Apr 2008) | 1 line
corrections ("reStructuredText" is one word)
................
r62436 | david.goodger | 2008-04-21 16:43:33 +0200 (Mon, 21 Apr 2008) | 1 line
capitalization
................
r62441 | gregory.p.smith | 2008-04-21 19:46:40 +0200 (Mon, 21 Apr 2008) | 2 lines
explicitly flush after the ... since there wasn't a newline
................
r62444 | jeroen.ruigrok | 2008-04-21 22:15:39 +0200 (Mon, 21 Apr 2008) | 2 lines
Windows x64 also falls under VER_PLATFORM_WIN32_NT.
................
r62446 | gregory.p.smith | 2008-04-21 23:31:08 +0200 (Mon, 21 Apr 2008) | 3 lines
If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
................
r62447 | mark.dickinson | 2008-04-22 00:32:24 +0200 (Tue, 22 Apr 2008) | 8 lines
test_math and test_cmath are failing on the FreeBSD 6.2 trunk buildbot,
apparently because tanh(-0.) loses the sign of zero on that platform.
If true, this is a bug in FreeBSD.
Added a configure test to verify this. I still need to figure out
how best to deal with this failure.
................
r62448 | amaury.forgeotdarc | 2008-04-22 00:35:30 +0200 (Tue, 22 Apr 2008) | 7 lines
Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.
This causes IDLE to crash when too many warnings are printed.
Will backport.
................
r62450 | benjamin.peterson | 2008-04-22 00:57:00 +0200 (Tue, 22 Apr 2008) | 2 lines
Fix Sphinx warnings
................
r62451 | mark.dickinson | 2008-04-22 02:54:27 +0200 (Tue, 22 Apr 2008) | 3 lines
Make configure test for tanh(-0.) == -0. committed in r62447 actually
work. (The test wasn't properly linked with libm. Sigh.)
................
r62452 | benjamin.peterson | 2008-04-22 04:16:03 +0200 (Tue, 22 Apr 2008) | 2 lines
Various io doc updates
................
r62453 | neal.norwitz | 2008-04-22 07:07:47 +0200 (Tue, 22 Apr 2008) | 1 line
Add Thomas Lee
................
r62454 | gregory.p.smith | 2008-04-22 10:08:41 +0200 (Tue, 22 Apr 2008) | 8 lines
Major improvements:
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
................
r62455 | gregory.p.smith | 2008-04-22 10:11:33 +0200 (Tue, 22 Apr 2008) | 2 lines
update the getpass entry
................
r62463 | amaury.forgeotdarc | 2008-04-22 23:14:41 +0200 (Tue, 22 Apr 2008) | 5 lines
Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.
Will backport.
................
r62465 | skip.montanaro | 2008-04-23 00:45:09 +0200 (Wed, 23 Apr 2008) | 3 lines
Factor in documentation changes from issue 1753732.
................
r62466 | gregory.p.smith | 2008-04-23 03:06:42 +0200 (Wed, 23 Apr 2008) | 2 lines
syntax fixup
................
r62469 | benjamin.peterson | 2008-04-23 22:38:06 +0200 (Wed, 23 Apr 2008) | 2 lines
#2673 Fix example typo in optparse docs
................
r62474 | martin.v.loewis | 2008-04-24 11:50:50 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Guilherme Polo.
................
r62476 | martin.v.loewis | 2008-04-24 15:16:36 +0200 (Thu, 24 Apr 2008) | 3 lines
Remove Py_Refcnt, Py_Type, Py_Size, as they were added only
for backwards compatibility, yet 2.5 did not have them at all.
................
r62477 | martin.v.loewis | 2008-04-24 15:17:24 +0200 (Thu, 24 Apr 2008) | 2 lines
Fix typo.
................
r62478 | martin.v.loewis | 2008-04-24 15:18:03 +0200 (Thu, 24 Apr 2008) | 2 lines
Add Jesus Cea.
................
r62480 | amaury.forgeotdarc | 2008-04-24 20:07:05 +0200 (Thu, 24 Apr 2008) | 4 lines
Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
................
r62485 | amaury.forgeotdarc | 2008-04-24 22:10:26 +0200 (Thu, 24 Apr 2008) | 5 lines
Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
................
r62492 | neal.norwitz | 2008-04-25 05:40:17 +0200 (Fri, 25 Apr 2008) | 1 line
Fix typo (now -> no)
................
r62497 | armin.rigo | 2008-04-25 11:35:18 +0200 (Fri, 25 Apr 2008) | 2 lines
A new crasher.
................
r62498 | thomas.heller | 2008-04-25 17:44:16 +0200 (Fri, 25 Apr 2008) | 1 line
Add from_buffer and from_buffer_copy class methods to ctypes types.
................
r62500 | mark.dickinson | 2008-04-25 18:59:09 +0200 (Fri, 25 Apr 2008) | 3 lines
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.
................
r62507 | benjamin.peterson | 2008-04-25 23:43:56 +0200 (Fri, 25 Apr 2008) | 2 lines
Allow test_import to work when it is invoked directly
................
r62513 | georg.brandl | 2008-04-26 20:31:07 +0200 (Sat, 26 Apr 2008) | 2 lines
#2691: document PyLong (s)size_t APIs, patch by Alexander Belopolsky.
................
r62514 | georg.brandl | 2008-04-26 20:32:17 +0200 (Sat, 26 Apr 2008) | 2 lines
Add missing return type to dealloc.
................
r62516 | alexandre.vassalotti | 2008-04-27 02:52:24 +0200 (Sun, 27 Apr 2008) | 2 lines
Fixed URL of PEP 205 in weakref's module docstring.
................
r62521 | georg.brandl | 2008-04-27 11:39:59 +0200 (Sun, 27 Apr 2008) | 2 lines
#2677: add note that not all functions may accept keyword args.
................
r62531 | georg.brandl | 2008-04-27 19:38:55 +0200 (Sun, 27 Apr 2008) | 2 lines
Use correct XHTML tags.
................
r62535 | benjamin.peterson | 2008-04-27 20:14:39 +0200 (Sun, 27 Apr 2008) | 2 lines
#2700 Document PyNumber_ToBase
................
r62545 | skip.montanaro | 2008-04-27 22:53:57 +0200 (Sun, 27 Apr 2008) | 1 line
minor wording changes, rewrap a few lines
................
r62546 | kurt.kaiser | 2008-04-27 23:07:41 +0200 (Sun, 27 Apr 2008) | 7 lines
Home / Control-A toggles between left margin and end of leading white
space. Patch 1196903 Jeff Shute.
M idlelib/PyShell.py
M idlelib/EditorWindow.py
M idlelib/NEWS.txt
................
r62548 | kurt.kaiser | 2008-04-27 23:38:05 +0200 (Sun, 27 Apr 2008) | 2 lines
Improved AutoCompleteWindow logic. Patch 2062 Tal Einat.
................
r62549 | kurt.kaiser | 2008-04-27 23:52:19 +0200 (Sun, 27 Apr 2008) | 4 lines
Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows. Patch 2061 Tal Einat.
................
r62550 | skip.montanaro | 2008-04-28 00:49:56 +0200 (Mon, 28 Apr 2008) | 6 lines
A few small changes:
* The only exception we should catch when trying to import cStringIO is an
ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
................
r62551 | skip.montanaro | 2008-04-28 00:52:02 +0200 (Mon, 28 Apr 2008) | 4 lines
Wrap some long paragraphs and include the default values for optional
function parameters.
................
r62553 | skip.montanaro | 2008-04-28 04:57:23 +0200 (Mon, 28 Apr 2008) | 7 lines
Minor cleanups:
* Avoid creating unused local variables where we can. Where we can't prefix
the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
function.
* Use None as default path arg to readmodule and readmodule_ex.
................
r62554 | skip.montanaro | 2008-04-28 04:59:45 +0200 (Mon, 28 Apr 2008) | 6 lines
Correct documentation to match implementation: "Class" instead of
"class_descriptor", "Function" instead of "function_descriptor". Note
default path value for readmodule*. Wrap some long paragraphs. Don't
mention 'inpackage' which isn't part of the public API.
................
r62555 | brett.cannon | 2008-04-28 05:23:50 +0200 (Mon, 28 Apr 2008) | 5 lines
Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.
Closes issue #2699.
................
r62556 | skip.montanaro | 2008-04-28 05:25:37 +0200 (Mon, 28 Apr 2008) | 2 lines
Wrap some long lines.
................
r62557 | skip.montanaro | 2008-04-28 05:27:53 +0200 (Mon, 28 Apr 2008) | 6 lines
Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py). Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
................
r62558 | brett.cannon | 2008-04-28 06:50:06 +0200 (Mon, 28 Apr 2008) | 3 lines
Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
................
r62559 | georg.brandl | 2008-04-28 07:16:30 +0200 (Mon, 28 Apr 2008) | 2 lines
Fix markup.
................
r62569 | amaury.forgeotdarc | 2008-04-28 23:07:06 +0200 (Mon, 28 Apr 2008) | 5 lines
test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
................
r62574 | andrew.kuchling | 2008-04-29 04:03:54 +0200 (Tue, 29 Apr 2008) | 1 line
Strip down SSL docs; I'm not managing to get test programs working, so I'll just give a minimal description
................
r62577 | martin.v.loewis | 2008-04-29 08:10:53 +0200 (Tue, 29 Apr 2008) | 2 lines
Add Rodrigo and Heiko.
................
r62593 | nick.coghlan | 2008-04-30 16:23:36 +0200 (Wed, 30 Apr 2008) | 1 line
Update command line usage documentation to reflect 2.6 changes (also includes some minor cleanups). Addresses TODO list issue 2258
................
r62595 | andrew.kuchling | 2008-04-30 18:19:55 +0200 (Wed, 30 Apr 2008) | 1 line
Typo fix
................
r62604 | benjamin.peterson | 2008-04-30 23:03:58 +0200 (Wed, 30 Apr 2008) | 2 lines
make test_support's captured_output a bit more robust when exceptions happen
................
r62605 | georg.brandl | 2008-04-30 23:08:42 +0200 (Wed, 30 Apr 2008) | 2 lines
#1748: use functools.wraps instead of rolling own metadata update.
................
r62606 | benjamin.peterson | 2008-04-30 23:25:55 +0200 (Wed, 30 Apr 2008) | 2 lines
Remove some from __future__ import with_statements
................
r62608 | benjamin.peterson | 2008-05-01 00:03:36 +0200 (Thu, 01 May 2008) | 2 lines
Fix typo in whatsnew
................
r62616 | georg.brandl | 2008-05-01 20:24:32 +0200 (Thu, 01 May 2008) | 2 lines
Fix synopsis.
................
r62626 | brett.cannon | 2008-05-02 04:25:09 +0200 (Fri, 02 May 2008) | 6 lines
Fix a backwards-compatibility mistake where a new optional argument for
warnings.showwarning() was being used. This broke pre-existing replacements for
the function since they didn't support the extra argument.
Closes issue 2705.
................
r62627 | gregory.p.smith | 2008-05-02 09:26:52 +0200 (Fri, 02 May 2008) | 20 lines
This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one). In short:
buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.
This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.
It also documents what the socket._fileobject._rbufsize member is
actually used for.
This is a candidate for back porting to 2.5.
................
r62636 | mark.hammond | 2008-05-02 14:48:15 +0200 (Fri, 02 May 2008) | 2 lines
#2581: Vista UAC/elevation support for bdist_wininst
................
r62638 | facundo.batista | 2008-05-02 19:39:00 +0200 (Fri, 02 May 2008) | 3 lines
Fixed some test structures. Thanks Mark Dickinson.
................
r62644 | ronald.oussoren | 2008-05-02 21:45:11 +0200 (Fri, 02 May 2008) | 7 lines
Fix for issue #2573: Can't change the framework name on OS X builds
This introduces a new configure option: --with-framework-name=NAME
(defaulting to 'Python'). This allows you to install several copies
of the Python framework with different names (such as a normal build
and a debug build).
................
r62645 | ronald.oussoren | 2008-05-02 21:58:56 +0200 (Fri, 02 May 2008) | 2 lines
Finish fix for issue2573, previous patch was incomplete.
................
r62647 | martin.v.loewis | 2008-05-02 23:30:20 +0200 (Fri, 02 May 2008) | 13 lines
Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
........
r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines
Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines
Fix whitespace.
........
................
r62648 | ronald.oussoren | 2008-05-02 23:42:35 +0200 (Fri, 02 May 2008) | 4 lines
Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
................
r62651 | ronald.oussoren | 2008-05-02 23:54:56 +0200 (Fri, 02 May 2008) | 2 lines
Fix for issue #2520 (cannot import macerrors)
................
r62652 | benjamin.peterson | 2008-05-03 00:12:58 +0200 (Sat, 03 May 2008) | 2 lines
capitalization nit for reStructuredText
................
r62653 | brett.cannon | 2008-05-03 03:02:41 +0200 (Sat, 03 May 2008) | 2 lines
Fix some indentation errors.
................
r62656 | brett.cannon | 2008-05-03 05:19:39 +0200 (Sat, 03 May 2008) | 6 lines
Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.
Closes issue2743.
................
r62661 | amaury.forgeotdarc | 2008-05-03 14:21:13 +0200 (Sat, 03 May 2008) | 8 lines
In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().
The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
................
r62663 | benjamin.peterson | 2008-05-03 17:56:42 +0200 (Sat, 03 May 2008) | 2 lines
The compiling struct is now passed around to all AST helpers (see issue 2720)
................
r62680 | benjamin.peterson | 2008-05-03 23:35:18 +0200 (Sat, 03 May 2008) | 2 lines
Moved testing of builtin types out of test_builtin and into type specific modules
................
r62686 | mark.dickinson | 2008-05-04 04:25:46 +0200 (Sun, 04 May 2008) | 4 lines
Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
................
r62687 | benjamin.peterson | 2008-05-04 05:05:49 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in whatsnew
................
r62696 | georg.brandl | 2008-05-04 11:15:04 +0200 (Sun, 04 May 2008) | 2 lines
#2752: wrong meaning of '' for socket host.
................
r62699 | christian.heimes | 2008-05-04 13:50:53 +0200 (Sun, 04 May 2008) | 1 line
Added note that Python requires at least Win2k SP4
................
r62700 | gerhard.haering | 2008-05-04 14:59:57 +0200 (Sun, 04 May 2008) | 3 lines
SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG
#ifdefing was useless.
................
r62701 | gerhard.haering | 2008-05-04 15:15:12 +0200 (Sun, 04 May 2008) | 3 lines
Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
................
r62702 | gerhard.haering | 2008-05-04 15:42:44 +0200 (Sun, 04 May 2008) | 5 lines
Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
................
r62703 | georg.brandl | 2008-05-04 17:45:05 +0200 (Sun, 04 May 2008) | 2 lines
#2757: Remove spare newline.
................
r62711 | benjamin.peterson | 2008-05-04 21:10:02 +0200 (Sun, 04 May 2008) | 2 lines
Fix typo in bugs.rst
................
2008-05-04 19:42:01 -03:00
|
|
|
return 42
|
2009-12-05 16:28:34 -04:00
|
|
|
def __trunc__(self):
|
|
|
|
return 1729
|
|
|
|
self.assertEqual(int(LongTrunc()), 1729)
|
2005-06-13 18:44:48 -03:00
|
|
|
|
2011-10-23 16:07:13 -03:00
|
|
|
def check_float_conversion(self, n):
|
|
|
|
# Check that int -> float conversion behaviour matches
|
|
|
|
# that of the pure Python version above.
|
|
|
|
try:
|
|
|
|
actual = float(n)
|
|
|
|
except OverflowError:
|
|
|
|
actual = 'overflow'
|
|
|
|
|
|
|
|
try:
|
|
|
|
expected = int_to_float(n)
|
|
|
|
except OverflowError:
|
|
|
|
expected = 'overflow'
|
|
|
|
|
|
|
|
msg = ("Error in conversion of integer {} to float. "
|
|
|
|
"Got {}, expected {}.".format(n, actual, expected))
|
|
|
|
self.assertEqual(actual, expected, msg)
|
|
|
|
|
2010-12-04 11:17:38 -04:00
|
|
|
@support.requires_IEEE_754
|
2009-04-20 18:38:00 -03:00
|
|
|
def test_float_conversion(self):
|
|
|
|
|
|
|
|
exact_values = [0, 1, 2,
|
|
|
|
2**53-3,
|
|
|
|
2**53-2,
|
|
|
|
2**53-1,
|
|
|
|
2**53,
|
|
|
|
2**53+2,
|
|
|
|
2**54-4,
|
|
|
|
2**54-2,
|
|
|
|
2**54,
|
|
|
|
2**54+4]
|
|
|
|
for x in exact_values:
|
|
|
|
self.assertEqual(float(x), x)
|
|
|
|
self.assertEqual(float(-x), -x)
|
|
|
|
|
|
|
|
# test round-half-even
|
|
|
|
for x, y in [(1, 0), (2, 2), (3, 4), (4, 4), (5, 4), (6, 6), (7, 8)]:
|
|
|
|
for p in range(15):
|
|
|
|
self.assertEqual(int(float(2**p*(2**53+x))), 2**p*(2**53+y))
|
|
|
|
|
|
|
|
for x, y in [(0, 0), (1, 0), (2, 0), (3, 4), (4, 4), (5, 4), (6, 8),
|
|
|
|
(7, 8), (8, 8), (9, 8), (10, 8), (11, 12), (12, 12),
|
|
|
|
(13, 12), (14, 16), (15, 16)]:
|
|
|
|
for p in range(15):
|
|
|
|
self.assertEqual(int(float(2**p*(2**54+x))), 2**p*(2**54+y))
|
|
|
|
|
|
|
|
# behaviour near extremes of floating-point range
|
|
|
|
int_dbl_max = int(DBL_MAX)
|
|
|
|
top_power = 2**DBL_MAX_EXP
|
|
|
|
halfway = (int_dbl_max + top_power)//2
|
|
|
|
self.assertEqual(float(int_dbl_max), DBL_MAX)
|
|
|
|
self.assertEqual(float(int_dbl_max+1), DBL_MAX)
|
|
|
|
self.assertEqual(float(halfway-1), DBL_MAX)
|
|
|
|
self.assertRaises(OverflowError, float, halfway)
|
|
|
|
self.assertEqual(float(1-halfway), -DBL_MAX)
|
|
|
|
self.assertRaises(OverflowError, float, -halfway)
|
|
|
|
self.assertRaises(OverflowError, float, top_power-1)
|
|
|
|
self.assertRaises(OverflowError, float, top_power)
|
|
|
|
self.assertRaises(OverflowError, float, top_power+1)
|
|
|
|
self.assertRaises(OverflowError, float, 2*top_power-1)
|
|
|
|
self.assertRaises(OverflowError, float, 2*top_power)
|
|
|
|
self.assertRaises(OverflowError, float, top_power*top_power)
|
|
|
|
|
|
|
|
for p in range(100):
|
|
|
|
x = 2**p * (2**53 + 1) + 1
|
|
|
|
y = 2**p * (2**53 + 2)
|
|
|
|
self.assertEqual(int(float(x)), y)
|
|
|
|
|
|
|
|
x = 2**p * (2**53 + 1)
|
|
|
|
y = 2**p * 2**53
|
|
|
|
self.assertEqual(int(float(x)), y)
|
|
|
|
|
2011-10-23 16:07:13 -03:00
|
|
|
# Compare builtin float conversion with pure Python int_to_float
|
|
|
|
# function above.
|
|
|
|
test_values = [
|
|
|
|
int_dbl_max-1, int_dbl_max, int_dbl_max+1,
|
|
|
|
halfway-1, halfway, halfway + 1,
|
|
|
|
top_power-1, top_power, top_power+1,
|
|
|
|
2*top_power-1, 2*top_power, top_power*top_power,
|
|
|
|
]
|
|
|
|
test_values.extend(exact_values)
|
|
|
|
for p in range(-4, 8):
|
|
|
|
for x in range(-128, 128):
|
|
|
|
test_values.append(2**(p+53) + x)
|
|
|
|
for value in test_values:
|
|
|
|
self.check_float_conversion(value)
|
|
|
|
self.check_float_conversion(-value)
|
|
|
|
|
2005-06-13 18:44:48 -03:00
|
|
|
def test_float_overflow(self):
|
|
|
|
for x in -2.0, -1.0, 0.0, 1.0, 2.0:
|
2007-01-15 12:59:06 -04:00
|
|
|
self.assertEqual(float(int(x)), x)
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
shuge = '12345' * 120
|
2007-01-15 12:59:06 -04:00
|
|
|
huge = 1 << 30000
|
2005-06-13 18:44:48 -03:00
|
|
|
mhuge = -huge
|
|
|
|
namespace = {'huge': huge, 'mhuge': mhuge, 'shuge': shuge, 'math': math}
|
|
|
|
for test in ["float(huge)", "float(mhuge)",
|
|
|
|
"complex(huge)", "complex(mhuge)",
|
|
|
|
"complex(huge, 1)", "complex(mhuge, 1)",
|
|
|
|
"complex(1, huge)", "complex(1, mhuge)",
|
|
|
|
"1. + huge", "huge + 1.", "1. + mhuge", "mhuge + 1.",
|
|
|
|
"1. - huge", "huge - 1.", "1. - mhuge", "mhuge - 1.",
|
|
|
|
"1. * huge", "huge * 1.", "1. * mhuge", "mhuge * 1.",
|
|
|
|
"1. // huge", "huge // 1.", "1. // mhuge", "mhuge // 1.",
|
|
|
|
"1. / huge", "huge / 1.", "1. / mhuge", "mhuge / 1.",
|
|
|
|
"1. ** huge", "huge ** 1.", "1. ** mhuge", "mhuge ** 1.",
|
|
|
|
"math.sin(huge)", "math.sin(mhuge)",
|
|
|
|
"math.sqrt(huge)", "math.sqrt(mhuge)", # should do better
|
2007-08-24 00:46:30 -03:00
|
|
|
# math.floor() of an int returns an int now
|
|
|
|
##"math.floor(huge)", "math.floor(mhuge)",
|
|
|
|
]:
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
self.assertRaises(OverflowError, eval, test, namespace)
|
|
|
|
|
2009-12-05 16:28:34 -04:00
|
|
|
# XXX Perhaps float(shuge) can raise OverflowError on some box?
|
|
|
|
# The comparison should not.
|
|
|
|
self.assertNotEqual(float(shuge), int(shuge),
|
|
|
|
"float(shuge) should not equal int(shuge)")
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
def test_logs(self):
|
|
|
|
LOG10E = math.log10(math.e)
|
|
|
|
|
2007-05-07 19:24:25 -03:00
|
|
|
for exp in list(range(10)) + [100, 1000, 10000]:
|
2005-06-13 18:44:48 -03:00
|
|
|
value = 10 ** exp
|
|
|
|
log10 = math.log10(value)
|
|
|
|
self.assertAlmostEqual(log10, exp)
|
|
|
|
|
|
|
|
# log10(value) == exp, so log(value) == log10(value)/log10(e) ==
|
|
|
|
# exp/LOG10E
|
|
|
|
expected = exp / LOG10E
|
|
|
|
log = math.log(value)
|
|
|
|
self.assertAlmostEqual(log, expected)
|
|
|
|
|
2007-01-15 12:59:06 -04:00
|
|
|
for bad in -(1 << 10000), -2, 0:
|
2005-06-13 18:44:48 -03:00
|
|
|
self.assertRaises(ValueError, math.log, bad)
|
|
|
|
self.assertRaises(ValueError, math.log10, bad)
|
|
|
|
|
|
|
|
def test_mixed_compares(self):
|
|
|
|
eq = self.assertEqual
|
|
|
|
|
2013-08-27 13:40:23 -03:00
|
|
|
# We're mostly concerned with that mixing floats and ints does the
|
|
|
|
# right stuff, even when ints are too large to fit in a float.
|
2005-06-13 18:44:48 -03:00
|
|
|
# The safest way to check the results is to use an entirely different
|
|
|
|
# method, which we do here via a skeletal rational class (which
|
2013-08-27 13:40:23 -03:00
|
|
|
# represents all Python ints and floats exactly).
|
2005-06-13 18:44:48 -03:00
|
|
|
class Rat:
|
|
|
|
def __init__(self, value):
|
2007-05-03 18:05:51 -03:00
|
|
|
if isinstance(value, int):
|
2005-06-13 18:44:48 -03:00
|
|
|
self.n = value
|
|
|
|
self.d = 1
|
|
|
|
elif isinstance(value, float):
|
|
|
|
# Convert to exact rational equivalent.
|
|
|
|
f, e = math.frexp(abs(value))
|
|
|
|
assert f == 0 or 0.5 <= f < 1.0
|
|
|
|
# |value| = f * 2**e exactly
|
|
|
|
|
|
|
|
# Suck up CHUNK bits at a time; 28 is enough so that we suck
|
|
|
|
# up all bits in 2 iterations for all known binary double-
|
|
|
|
# precision formats, and small enough to fit in an int.
|
|
|
|
CHUNK = 28
|
|
|
|
top = 0
|
|
|
|
# invariant: |value| = (top + f) * 2**e exactly
|
|
|
|
while f:
|
|
|
|
f = math.ldexp(f, CHUNK)
|
|
|
|
digit = int(f)
|
|
|
|
assert digit >> CHUNK == 0
|
|
|
|
top = (top << CHUNK) | digit
|
|
|
|
f -= digit
|
|
|
|
assert 0.0 <= f < 1.0
|
|
|
|
e -= CHUNK
|
|
|
|
|
|
|
|
# Now |value| = top * 2**e exactly.
|
|
|
|
if e >= 0:
|
|
|
|
n = top << e
|
|
|
|
d = 1
|
|
|
|
else:
|
|
|
|
n = top
|
|
|
|
d = 1 << -e
|
|
|
|
if value < 0:
|
|
|
|
n = -n
|
|
|
|
self.n = n
|
|
|
|
self.d = d
|
|
|
|
assert float(n) / float(d) == value
|
2004-09-23 05:06:40 -03:00
|
|
|
else:
|
Merged revisions 78018,78035-78040,78042-78043,78046,78048-78052,78054,78059,78075-78080 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78018 | georg.brandl | 2010-02-06 11:08:21 +0100 (Sa, 06 Feb 2010) | 1 line
#7864: make deprecation notices a bit clearer.
........
r78035 | georg.brandl | 2010-02-06 23:44:17 +0100 (Sa, 06 Feb 2010) | 1 line
Fix duplicate import.
........
r78036 | georg.brandl | 2010-02-06 23:49:47 +0100 (Sa, 06 Feb 2010) | 1 line
Remove unused import.
........
r78037 | georg.brandl | 2010-02-06 23:59:15 +0100 (Sa, 06 Feb 2010) | 1 line
No need to assign the results of expressions used only for side effects.
........
r78038 | georg.brandl | 2010-02-07 00:02:29 +0100 (So, 07 Feb 2010) | 1 line
Add a missing import.
........
r78039 | georg.brandl | 2010-02-07 00:06:24 +0100 (So, 07 Feb 2010) | 1 line
Add missing imports.
........
r78040 | georg.brandl | 2010-02-07 00:08:00 +0100 (So, 07 Feb 2010) | 1 line
Fix a few UnboundLocalErrors in test_long.
........
r78042 | georg.brandl | 2010-02-07 00:12:12 +0100 (So, 07 Feb 2010) | 1 line
Add missing import.
........
r78043 | georg.brandl | 2010-02-07 00:12:19 +0100 (So, 07 Feb 2010) | 1 line
Remove duplicate test method.
........
r78046 | georg.brandl | 2010-02-07 00:18:00 +0100 (So, 07 Feb 2010) | 1 line
Fix various missing import/unbound name errors.
........
r78048 | georg.brandl | 2010-02-07 00:23:45 +0100 (So, 07 Feb 2010) | 1 line
We heard you like test failures so we put unbound locals in your test so that you can fail while you fail.
........
r78049 | georg.brandl | 2010-02-07 00:33:33 +0100 (So, 07 Feb 2010) | 1 line
Fix import/access for some identifiers. _TestSharedCTypes does not seem to be executed?
........
r78050 | georg.brandl | 2010-02-07 00:34:10 +0100 (So, 07 Feb 2010) | 1 line
Fix more unbound locals in code paths that do not seem to be used.
........
r78051 | georg.brandl | 2010-02-07 00:53:52 +0100 (So, 07 Feb 2010) | 1 line
Add missing import when running these tests standalone.
........
r78052 | georg.brandl | 2010-02-07 00:54:04 +0100 (So, 07 Feb 2010) | 1 line
Add missing import when running these tests standalone.
........
r78054 | georg.brandl | 2010-02-07 00:58:25 +0100 (So, 07 Feb 2010) | 1 line
Add missing import.
........
r78059 | georg.brandl | 2010-02-07 12:34:15 +0100 (So, 07 Feb 2010) | 1 line
Use "regexp" consistently.
........
r78075 | georg.brandl | 2010-02-07 13:16:12 +0100 (So, 07 Feb 2010) | 1 line
Fix another duplicated test method.
........
r78076 | georg.brandl | 2010-02-07 13:19:43 +0100 (So, 07 Feb 2010) | 1 line
Fix wrong usage of "except X, Y:".
........
r78077 | georg.brandl | 2010-02-07 13:25:50 +0100 (So, 07 Feb 2010) | 1 line
Fix two redefined test methods.
........
r78078 | georg.brandl | 2010-02-07 13:27:06 +0100 (So, 07 Feb 2010) | 1 line
Fix a redefined test method.
........
r78079 | georg.brandl | 2010-02-07 13:34:26 +0100 (So, 07 Feb 2010) | 1 line
Add a minimal test for fnmatchcase().
........
r78080 | georg.brandl | 2010-02-07 13:55:12 +0100 (So, 07 Feb 2010) | 1 line
Remove duplicate test method.
........
2010-03-14 07:23:39 -03:00
|
|
|
raise TypeError("can't deal with %r" % value)
|
2005-06-13 18:44:48 -03:00
|
|
|
|
2008-10-16 16:34:46 -03:00
|
|
|
def _cmp__(self, other):
|
2005-06-13 18:44:48 -03:00
|
|
|
if not isinstance(other, Rat):
|
|
|
|
other = Rat(other)
|
2009-01-27 14:17:45 -04:00
|
|
|
x, y = self.n * other.d, self.d * other.n
|
|
|
|
return (x > y) - (x < y)
|
2008-10-16 16:34:46 -03:00
|
|
|
def __eq__(self, other):
|
|
|
|
return self._cmp__(other) == 0
|
|
|
|
def __ge__(self, other):
|
|
|
|
return self._cmp__(other) >= 0
|
|
|
|
def __gt__(self, other):
|
|
|
|
return self._cmp__(other) > 0
|
|
|
|
def __le__(self, other):
|
|
|
|
return self._cmp__(other) <= 0
|
|
|
|
def __lt__(self, other):
|
|
|
|
return self._cmp__(other) < 0
|
2005-06-13 18:44:48 -03:00
|
|
|
|
|
|
|
cases = [0, 0.001, 0.99, 1.0, 1.5, 1e20, 1e200]
|
|
|
|
# 2**48 is an important boundary in the internals. 2**53 is an
|
|
|
|
# important boundary for IEEE double precision.
|
|
|
|
for t in 2.0**48, 2.0**50, 2.0**53:
|
|
|
|
cases.extend([t - 1.0, t - 0.3, t, t + 0.3, t + 1.0,
|
2007-01-15 12:59:06 -04:00
|
|
|
int(t-1), int(t), int(t+1)])
|
2007-12-04 19:02:19 -04:00
|
|
|
cases.extend([0, 1, 2, sys.maxsize, float(sys.maxsize)])
|
2009-12-05 16:28:34 -04:00
|
|
|
# 1 << 20000 should exceed all double formats. int(1e200) is to
|
2005-06-13 18:44:48 -03:00
|
|
|
# check that we get equality with 1e200 above.
|
2007-01-15 12:59:06 -04:00
|
|
|
t = int(1e200)
|
|
|
|
cases.extend([0, 1, 2, 1 << 20000, t-1, t, t+1])
|
2005-06-13 18:44:48 -03:00
|
|
|
cases.extend([-x for x in cases])
|
|
|
|
for x in cases:
|
|
|
|
Rx = Rat(x)
|
|
|
|
for y in cases:
|
|
|
|
Ry = Rat(y)
|
2009-01-27 14:17:45 -04:00
|
|
|
Rcmp = (Rx > Ry) - (Rx < Ry)
|
2015-09-25 20:50:47 -03:00
|
|
|
with self.subTest(x=x, y=y, Rcmp=Rcmp):
|
|
|
|
xycmp = (x > y) - (x < y)
|
|
|
|
eq(Rcmp, xycmp)
|
|
|
|
eq(x == y, Rcmp == 0)
|
|
|
|
eq(x != y, Rcmp != 0)
|
|
|
|
eq(x < y, Rcmp < 0)
|
|
|
|
eq(x <= y, Rcmp <= 0)
|
|
|
|
eq(x > y, Rcmp > 0)
|
|
|
|
eq(x >= y, Rcmp >= 0)
|
2005-06-13 18:44:48 -03:00
|
|
|
|
2008-02-11 13:55:01 -04:00
|
|
|
def test__format__(self):
|
2007-08-24 23:26:07 -03:00
|
|
|
self.assertEqual(format(123456789, 'd'), '123456789')
|
|
|
|
self.assertEqual(format(123456789, 'd'), '123456789')
|
2016-09-10 00:06:47 -03:00
|
|
|
self.assertEqual(format(123456789, ','), '123,456,789')
|
|
|
|
self.assertEqual(format(123456789, '_'), '123_456_789')
|
2007-08-24 23:26:07 -03:00
|
|
|
|
2007-08-30 19:23:08 -03:00
|
|
|
# sign and aligning are interdependent
|
|
|
|
self.assertEqual(format(1, "-"), '1')
|
|
|
|
self.assertEqual(format(-1, "-"), '-1')
|
|
|
|
self.assertEqual(format(1, "-3"), ' 1')
|
|
|
|
self.assertEqual(format(-1, "-3"), ' -1')
|
|
|
|
self.assertEqual(format(1, "+3"), ' +1')
|
|
|
|
self.assertEqual(format(-1, "+3"), ' -1')
|
|
|
|
self.assertEqual(format(1, " 3"), ' 1')
|
|
|
|
self.assertEqual(format(-1, " 3"), ' -1')
|
|
|
|
self.assertEqual(format(1, " "), ' 1')
|
|
|
|
self.assertEqual(format(-1, " "), '-1')
|
|
|
|
|
2007-08-24 23:26:07 -03:00
|
|
|
# hex
|
|
|
|
self.assertEqual(format(3, "x"), "3")
|
|
|
|
self.assertEqual(format(3, "X"), "3")
|
|
|
|
self.assertEqual(format(1234, "x"), "4d2")
|
|
|
|
self.assertEqual(format(-1234, "x"), "-4d2")
|
|
|
|
self.assertEqual(format(1234, "8x"), " 4d2")
|
2007-08-30 19:23:08 -03:00
|
|
|
self.assertEqual(format(-1234, "8x"), " -4d2")
|
2007-08-24 23:26:07 -03:00
|
|
|
self.assertEqual(format(1234, "x"), "4d2")
|
|
|
|
self.assertEqual(format(-1234, "x"), "-4d2")
|
|
|
|
self.assertEqual(format(-3, "x"), "-3")
|
|
|
|
self.assertEqual(format(-3, "X"), "-3")
|
|
|
|
self.assertEqual(format(int('be', 16), "x"), "be")
|
|
|
|
self.assertEqual(format(int('be', 16), "X"), "BE")
|
|
|
|
self.assertEqual(format(-int('be', 16), "x"), "-be")
|
|
|
|
self.assertEqual(format(-int('be', 16), "X"), "-BE")
|
2016-09-10 00:06:47 -03:00
|
|
|
self.assertRaises(ValueError, format, 1234567890, ',x')
|
|
|
|
self.assertEqual(format(1234567890, '_x'), '4996_02d2')
|
|
|
|
self.assertEqual(format(1234567890, '_X'), '4996_02D2')
|
2007-08-24 23:26:07 -03:00
|
|
|
|
|
|
|
# octal
|
2016-09-10 00:06:47 -03:00
|
|
|
self.assertEqual(format(3, "o"), "3")
|
|
|
|
self.assertEqual(format(-3, "o"), "-3")
|
|
|
|
self.assertEqual(format(1234, "o"), "2322")
|
|
|
|
self.assertEqual(format(-1234, "o"), "-2322")
|
|
|
|
self.assertEqual(format(1234, "-o"), "2322")
|
|
|
|
self.assertEqual(format(-1234, "-o"), "-2322")
|
|
|
|
self.assertEqual(format(1234, " o"), " 2322")
|
|
|
|
self.assertEqual(format(-1234, " o"), "-2322")
|
|
|
|
self.assertEqual(format(1234, "+o"), "+2322")
|
|
|
|
self.assertEqual(format(-1234, "+o"), "-2322")
|
|
|
|
self.assertRaises(ValueError, format, 1234567890, ',o')
|
|
|
|
self.assertEqual(format(1234567890, '_o'), '111_4540_1322')
|
|
|
|
|
|
|
|
# binary
|
2007-08-24 23:26:07 -03:00
|
|
|
self.assertEqual(format(3, "b"), "11")
|
|
|
|
self.assertEqual(format(-3, "b"), "-11")
|
|
|
|
self.assertEqual(format(1234, "b"), "10011010010")
|
|
|
|
self.assertEqual(format(-1234, "b"), "-10011010010")
|
|
|
|
self.assertEqual(format(1234, "-b"), "10011010010")
|
|
|
|
self.assertEqual(format(-1234, "-b"), "-10011010010")
|
|
|
|
self.assertEqual(format(1234, " b"), " 10011010010")
|
|
|
|
self.assertEqual(format(-1234, " b"), "-10011010010")
|
|
|
|
self.assertEqual(format(1234, "+b"), "+10011010010")
|
|
|
|
self.assertEqual(format(-1234, "+b"), "-10011010010")
|
2016-09-10 00:06:47 -03:00
|
|
|
self.assertRaises(ValueError, format, 1234567890, ',b')
|
|
|
|
self.assertEqual(format(12345, '_b'), '11_0000_0011_1001')
|
2007-08-24 23:26:07 -03:00
|
|
|
|
|
|
|
# make sure these are errors
|
|
|
|
self.assertRaises(ValueError, format, 3, "1.3") # precision disallowed
|
2016-09-10 00:06:47 -03:00
|
|
|
self.assertRaises(ValueError, format, 3, "_c") # underscore,
|
|
|
|
self.assertRaises(ValueError, format, 3, ",c") # comma, and
|
2007-08-24 23:26:07 -03:00
|
|
|
self.assertRaises(ValueError, format, 3, "+c") # sign not allowed
|
|
|
|
# with 'c'
|
2008-01-28 06:59:27 -04:00
|
|
|
|
2016-09-10 00:06:47 -03:00
|
|
|
self.assertRaisesRegex(ValueError, 'Cannot specify both', format, 3, '_,')
|
|
|
|
self.assertRaisesRegex(ValueError, 'Cannot specify both', format, 3, ',_')
|
|
|
|
self.assertRaisesRegex(ValueError, 'Cannot specify both', format, 3, '_,d')
|
|
|
|
self.assertRaisesRegex(ValueError, 'Cannot specify both', format, 3, ',_d')
|
|
|
|
|
2018-10-02 01:54:39 -03:00
|
|
|
self.assertRaisesRegex(ValueError, "Cannot specify ',' with 's'", format, 3, ',s')
|
|
|
|
self.assertRaisesRegex(ValueError, "Cannot specify '_' with 's'", format, 3, '_s')
|
|
|
|
|
2008-01-28 06:59:27 -04:00
|
|
|
# ensure that only int and float type specifiers work
|
2008-01-27 17:07:59 -04:00
|
|
|
for format_spec in ([chr(x) for x in range(ord('a'), ord('z')+1)] +
|
|
|
|
[chr(x) for x in range(ord('A'), ord('Z')+1)]):
|
2008-01-28 06:59:27 -04:00
|
|
|
if not format_spec in 'bcdoxXeEfFgGn%':
|
2008-01-27 17:07:59 -04:00
|
|
|
self.assertRaises(ValueError, format, 0, format_spec)
|
|
|
|
self.assertRaises(ValueError, format, 1, format_spec)
|
|
|
|
self.assertRaises(ValueError, format, -1, format_spec)
|
|
|
|
self.assertRaises(ValueError, format, 2**100, format_spec)
|
|
|
|
self.assertRaises(ValueError, format, -(2**100), format_spec)
|
|
|
|
|
2008-01-28 06:59:27 -04:00
|
|
|
# ensure that float type specifiers work; format converts
|
|
|
|
# the int to a float
|
Merged revisions 63078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
When forward porting this, I added _PyUnicode_InsertThousandsGrouping.
........
r63078 | eric.smith | 2008-05-11 15:52:48 -0400 (Sun, 11 May 2008) | 14 lines
Addresses issue 2802: 'n' formatting for integers.
Adds 'n' as a format specifier for integers, to mirror the same
specifier which is already available for floats. 'n' is the same as
'd', but inserts the current locale-specific thousands grouping.
I added this as a stringlib function, but it's only used by str type,
not unicode. This is because of an implementation detail in
unicode.format(), which does its own str->unicode conversion. But the
unicode version will be needed in 3.0, and it may be needed by other
code eventually in 2.6 (maybe decimal?), so I left it as a stringlib
implementation. As long as the unicode version isn't instantiated,
there's no overhead for this.
........
2008-05-11 18:00:57 -03:00
|
|
|
for format_spec in 'eEfFgG%':
|
2008-01-28 06:59:27 -04:00
|
|
|
for value in [0, 1, -1, 100, -100, 1234567890, -1234567890]:
|
|
|
|
self.assertEqual(format(value, format_spec),
|
|
|
|
format(float(value), format_spec))
|
2007-08-24 23:26:07 -03:00
|
|
|
|
2008-01-03 23:06:10 -04:00
|
|
|
def test_nan_inf(self):
|
2008-01-03 23:22:53 -04:00
|
|
|
self.assertRaises(OverflowError, int, float('inf'))
|
Merged revisions 65459,65472,65481,65518,65536,65581,65609,65637,65641,65644-65645 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65459 | gregory.p.smith | 2008-08-04 00:13:29 +0000 (Mon, 04 Aug 2008) | 4 lines
- Issue #1857: subprocess.Popen.poll gained an additional _deadstate keyword
argument in python 2.5, this broke code that subclassed Popen to include its
own poll method. Fixed my moving _deadstate to an _internal_poll method.
........
r65472 | andrew.kuchling | 2008-08-04 01:43:43 +0000 (Mon, 04 Aug 2008) | 3 lines
Bug 3228: Explicitly supply the file mode to avoid creating executable files,
and add corresponding tests.
Possible 2.5 backport candidate
........
r65481 | gregory.p.smith | 2008-08-04 07:33:37 +0000 (Mon, 04 Aug 2008) | 22 lines
Adds a sanity check to avoid a *very rare* infinite loop due to a corrupt tls
key list data structure in the thread startup path.
This change is a companion to r60148 which already successfully dealt with a
similar issue on thread shutdown.
In particular this loop has been observed happening from this call path:
#0 in find_key ()
#1 in PyThread_set_key_value ()
#2 in _PyGILState_NoteThreadState ()
#3 in PyThreadState_New ()
#4 in t_bootstrap ()
#5 in pthread_start_thread ()
I don't know how this happens but it does, *very* rarely. On more than
one hardware platform. I have not been able to reproduce it manually.
(A flaky mutex implementation on the system in question is one hypothesis).
As with r60148, the spinning we managed to observe in the wild was due to a
single list element pointing back upon itself.
........
r65518 | mark.dickinson | 2008-08-04 21:30:09 +0000 (Mon, 04 Aug 2008) | 7 lines
Issue #1481296: (again!) Make conversion of a float NaN to an int or
long raise ValueError instead of returning 0. Also, change the error
message for conversion of an infinity to an integer, replacing 'long' by
'integer', so that it's appropriate for both long(float('inf')) and
int(float('inf')).
........
r65536 | andrew.kuchling | 2008-08-05 01:00:57 +0000 (Tue, 05 Aug 2008) | 1 line
Bug 3228: take a test from Niels Gustaebel's patch, and based on his patch, check for having os.stat available
........
r65581 | guido.van.rossum | 2008-08-07 18:51:38 +0000 (Thu, 07 Aug 2008) | 3 lines
Patch by Ian Charnas from issue 3517.
Add F_FULLFSYNC if it exists (OS X only so far).
........
r65609 | antoine.pitrou | 2008-08-09 17:22:25 +0000 (Sat, 09 Aug 2008) | 3 lines
#3205: bz2 iterator fails silently on MemoryError
........
r65637 | georg.brandl | 2008-08-11 09:07:59 +0000 (Mon, 11 Aug 2008) | 3 lines
- Issue #3537: Fix an assertion failure when an empty but presized dict
object was stored in the freelist.
........
r65641 | jesse.noller | 2008-08-11 14:28:07 +0000 (Mon, 11 Aug 2008) | 2 lines
Remove the fqdn call for issue 3270
........
r65644 | antoine.pitrou | 2008-08-11 17:21:36 +0000 (Mon, 11 Aug 2008) | 3 lines
#3134: shutil referenced undefined WindowsError symbol
........
r65645 | jesse.noller | 2008-08-11 19:00:15 +0000 (Mon, 11 Aug 2008) | 2 lines
Fix the connection refused error part of issue 3419, use errno module instead of a static list of possible connection refused messages.
........
2008-08-12 05:35:52 -03:00
|
|
|
self.assertRaises(OverflowError, int, float('-inf'))
|
|
|
|
self.assertRaises(ValueError, int, float('nan'))
|
2008-01-03 23:06:10 -04:00
|
|
|
|
2016-02-11 11:26:27 -04:00
|
|
|
def test_mod_division(self):
|
|
|
|
with self.assertRaises(ZeroDivisionError):
|
|
|
|
_ = 1 % 0
|
|
|
|
|
|
|
|
self.assertEqual(13 % 10, 3)
|
|
|
|
self.assertEqual(-13 % 10, 7)
|
|
|
|
self.assertEqual(13 % -10, -7)
|
|
|
|
self.assertEqual(-13 % -10, -3)
|
|
|
|
|
|
|
|
self.assertEqual(12 % 4, 0)
|
|
|
|
self.assertEqual(-12 % 4, 0)
|
|
|
|
self.assertEqual(12 % -4, 0)
|
|
|
|
self.assertEqual(-12 % -4, 0)
|
|
|
|
|
2008-07-13 14:44:16 -03:00
|
|
|
def test_true_division(self):
|
|
|
|
huge = 1 << 40000
|
|
|
|
mhuge = -huge
|
|
|
|
self.assertEqual(huge / huge, 1.0)
|
|
|
|
self.assertEqual(mhuge / mhuge, 1.0)
|
|
|
|
self.assertEqual(huge / mhuge, -1.0)
|
|
|
|
self.assertEqual(mhuge / huge, -1.0)
|
|
|
|
self.assertEqual(1 / huge, 0.0)
|
|
|
|
self.assertEqual(1 / huge, 0.0)
|
|
|
|
self.assertEqual(1 / mhuge, 0.0)
|
|
|
|
self.assertEqual(1 / mhuge, 0.0)
|
|
|
|
self.assertEqual((666 * huge + (huge >> 1)) / huge, 666.5)
|
|
|
|
self.assertEqual((666 * mhuge + (mhuge >> 1)) / mhuge, 666.5)
|
|
|
|
self.assertEqual((666 * huge + (huge >> 1)) / mhuge, -666.5)
|
|
|
|
self.assertEqual((666 * mhuge + (mhuge >> 1)) / huge, -666.5)
|
|
|
|
self.assertEqual(huge / (huge << 1), 0.5)
|
|
|
|
self.assertEqual((1000000 * huge) / huge, 1000000)
|
|
|
|
|
|
|
|
namespace = {'huge': huge, 'mhuge': mhuge}
|
|
|
|
|
|
|
|
for overflow in ["float(huge)", "float(mhuge)",
|
|
|
|
"huge / 1", "huge / 2", "huge / -1", "huge / -2",
|
|
|
|
"mhuge / 100", "mhuge / 200"]:
|
|
|
|
self.assertRaises(OverflowError, eval, overflow, namespace)
|
|
|
|
|
|
|
|
for underflow in ["1 / huge", "2 / huge", "-1 / huge", "-2 / huge",
|
|
|
|
"100 / mhuge", "200 / mhuge"]:
|
|
|
|
result = eval(underflow, namespace)
|
|
|
|
self.assertEqual(result, 0.0,
|
|
|
|
"expected underflow to 0 from %r" % underflow)
|
|
|
|
|
|
|
|
for zero in ["huge / 0", "mhuge / 0"]:
|
|
|
|
self.assertRaises(ZeroDivisionError, eval, zero, namespace)
|
|
|
|
|
2016-02-11 11:26:27 -04:00
|
|
|
def test_floordiv(self):
|
|
|
|
with self.assertRaises(ZeroDivisionError):
|
|
|
|
_ = 1 // 0
|
|
|
|
|
|
|
|
self.assertEqual(2 // 3, 0)
|
|
|
|
self.assertEqual(2 // -3, -1)
|
|
|
|
self.assertEqual(-2 // 3, -1)
|
|
|
|
self.assertEqual(-2 // -3, 0)
|
|
|
|
|
|
|
|
self.assertEqual(-11 // -3, 3)
|
|
|
|
self.assertEqual(-11 // 3, -4)
|
|
|
|
self.assertEqual(11 // -3, -4)
|
|
|
|
self.assertEqual(11 // 3, 3)
|
|
|
|
|
|
|
|
self.assertEqual(-12 // -3, 4)
|
|
|
|
self.assertEqual(-12 // 3, -4)
|
|
|
|
self.assertEqual(12 // -3, -4)
|
|
|
|
self.assertEqual(12 // 3, 4)
|
|
|
|
|
2009-12-27 11:09:50 -04:00
|
|
|
def check_truediv(self, a, b, skip_small=True):
|
|
|
|
"""Verify that the result of a/b is correctly rounded, by
|
|
|
|
comparing it with a pure Python implementation of correctly
|
|
|
|
rounded division. b should be nonzero."""
|
|
|
|
|
|
|
|
# skip check for small a and b: in this case, the current
|
|
|
|
# implementation converts the arguments to float directly and
|
|
|
|
# then applies a float division. This can give doubly-rounded
|
|
|
|
# results on x87-using machines (particularly 32-bit Linux).
|
|
|
|
if skip_small and max(abs(a), abs(b)) < 2**DBL_MANT_DIG:
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
# use repr so that we can distinguish between -0.0 and 0.0
|
|
|
|
expected = repr(truediv(a, b))
|
|
|
|
except OverflowError:
|
|
|
|
expected = 'overflow'
|
|
|
|
except ZeroDivisionError:
|
|
|
|
expected = 'zerodivision'
|
|
|
|
|
|
|
|
try:
|
|
|
|
got = repr(a / b)
|
|
|
|
except OverflowError:
|
|
|
|
got = 'overflow'
|
|
|
|
except ZeroDivisionError:
|
|
|
|
got = 'zerodivision'
|
|
|
|
|
2009-12-27 17:34:05 -04:00
|
|
|
self.assertEqual(expected, got, "Incorrectly rounded division {}/{}: "
|
|
|
|
"expected {}, got {}".format(a, b, expected, got))
|
2009-12-27 11:09:50 -04:00
|
|
|
|
2010-12-04 11:17:38 -04:00
|
|
|
@support.requires_IEEE_754
|
2009-12-27 11:09:50 -04:00
|
|
|
def test_correctly_rounded_true_division(self):
|
|
|
|
# more stringent tests than those above, checking that the
|
|
|
|
# result of true division of ints is always correctly rounded.
|
|
|
|
# This test should probably be considered CPython-specific.
|
|
|
|
|
|
|
|
# Exercise all the code paths not involving Gb-sized ints.
|
|
|
|
# ... divisions involving zero
|
|
|
|
self.check_truediv(123, 0)
|
|
|
|
self.check_truediv(-456, 0)
|
|
|
|
self.check_truediv(0, 3)
|
|
|
|
self.check_truediv(0, -3)
|
|
|
|
self.check_truediv(0, 0)
|
|
|
|
# ... overflow or underflow by large margin
|
|
|
|
self.check_truediv(671 * 12345 * 2**DBL_MAX_EXP, 12345)
|
|
|
|
self.check_truediv(12345, 345678 * 2**(DBL_MANT_DIG - DBL_MIN_EXP))
|
|
|
|
# ... a much larger or smaller than b
|
|
|
|
self.check_truediv(12345*2**100, 98765)
|
|
|
|
self.check_truediv(12345*2**30, 98765*7**81)
|
|
|
|
# ... a / b near a boundary: one of 1, 2**DBL_MANT_DIG, 2**DBL_MIN_EXP,
|
|
|
|
# 2**DBL_MAX_EXP, 2**(DBL_MIN_EXP-DBL_MANT_DIG)
|
|
|
|
bases = (0, DBL_MANT_DIG, DBL_MIN_EXP,
|
|
|
|
DBL_MAX_EXP, DBL_MIN_EXP - DBL_MANT_DIG)
|
|
|
|
for base in bases:
|
|
|
|
for exp in range(base - 15, base + 15):
|
|
|
|
self.check_truediv(75312*2**max(exp, 0), 69187*2**max(-exp, 0))
|
|
|
|
self.check_truediv(69187*2**max(exp, 0), 75312*2**max(-exp, 0))
|
|
|
|
|
|
|
|
# overflow corner case
|
|
|
|
for m in [1, 2, 7, 17, 12345, 7**100,
|
|
|
|
-1, -2, -5, -23, -67891, -41**50]:
|
|
|
|
for n in range(-10, 10):
|
|
|
|
self.check_truediv(m*DBL_MIN_OVERFLOW + n, m)
|
|
|
|
self.check_truediv(m*DBL_MIN_OVERFLOW + n, -m)
|
|
|
|
|
|
|
|
# check detection of inexactness in shifting stage
|
|
|
|
for n in range(250):
|
|
|
|
# (2**DBL_MANT_DIG+1)/(2**DBL_MANT_DIG) lies halfway
|
|
|
|
# between two representable floats, and would usually be
|
|
|
|
# rounded down under round-half-to-even. The tiniest of
|
|
|
|
# additions to the numerator should cause it to be rounded
|
|
|
|
# up instead.
|
|
|
|
self.check_truediv((2**DBL_MANT_DIG + 1)*12345*2**200 + 2**n,
|
|
|
|
2**DBL_MANT_DIG*12345)
|
|
|
|
|
|
|
|
# 1/2731 is one of the smallest division cases that's subject
|
|
|
|
# to double rounding on IEEE 754 machines working internally with
|
|
|
|
# 64-bit precision. On such machines, the next check would fail,
|
|
|
|
# were it not explicitly skipped in check_truediv.
|
|
|
|
self.check_truediv(1, 2731)
|
|
|
|
|
|
|
|
# a particularly bad case for the old algorithm: gives an
|
|
|
|
# error of close to 3.5 ulps.
|
|
|
|
self.check_truediv(295147931372582273023, 295147932265116303360)
|
|
|
|
for i in range(1000):
|
|
|
|
self.check_truediv(10**(i+1), 10**i)
|
|
|
|
self.check_truediv(10**i, 10**(i+1))
|
|
|
|
|
|
|
|
# test round-half-to-even behaviour, normal result
|
|
|
|
for m in [1, 2, 4, 7, 8, 16, 17, 32, 12345, 7**100,
|
|
|
|
-1, -2, -5, -23, -67891, -41**50]:
|
|
|
|
for n in range(-10, 10):
|
|
|
|
self.check_truediv(2**DBL_MANT_DIG*m + n, m)
|
|
|
|
|
|
|
|
# test round-half-to-even, subnormal result
|
|
|
|
for n in range(-20, 20):
|
|
|
|
self.check_truediv(n, 2**1076)
|
|
|
|
|
|
|
|
# largeish random divisions: a/b where |a| <= |b| <=
|
|
|
|
# 2*|a|; |ans| is between 0.5 and 1.0, so error should
|
|
|
|
# always be bounded by 2**-54 with equality possible only
|
|
|
|
# if the least significant bit of q=ans*2**53 is zero.
|
|
|
|
for M in [10**10, 10**100, 10**1000]:
|
|
|
|
for i in range(1000):
|
|
|
|
a = random.randrange(1, M)
|
|
|
|
b = random.randrange(a, 2*a+1)
|
|
|
|
self.check_truediv(a, b)
|
|
|
|
self.check_truediv(-a, b)
|
|
|
|
self.check_truediv(a, -b)
|
|
|
|
self.check_truediv(-a, -b)
|
|
|
|
|
|
|
|
# and some (genuinely) random tests
|
|
|
|
for _ in range(10000):
|
|
|
|
a_bits = random.randrange(1000)
|
|
|
|
b_bits = random.randrange(1, 1000)
|
|
|
|
x = random.randrange(2**a_bits)
|
|
|
|
y = random.randrange(1, 2**b_bits)
|
|
|
|
self.check_truediv(x, y)
|
|
|
|
self.check_truediv(x, -y)
|
|
|
|
self.check_truediv(-x, y)
|
|
|
|
self.check_truediv(-x, -y)
|
2008-07-13 14:44:16 -03:00
|
|
|
|
2017-03-30 03:47:07 -03:00
|
|
|
def test_negative_shift_count(self):
|
|
|
|
with self.assertRaises(ValueError):
|
|
|
|
42 << -3
|
|
|
|
with self.assertRaises(ValueError):
|
|
|
|
42 << -(1 << 1000)
|
|
|
|
with self.assertRaises(ValueError):
|
|
|
|
42 >> -3
|
|
|
|
with self.assertRaises(ValueError):
|
|
|
|
42 >> -(1 << 1000)
|
|
|
|
|
2016-08-29 15:27:06 -03:00
|
|
|
def test_lshift_of_zero(self):
|
|
|
|
self.assertEqual(0 << 0, 0)
|
|
|
|
self.assertEqual(0 << 10, 0)
|
|
|
|
with self.assertRaises(ValueError):
|
|
|
|
0 << -1
|
2017-03-30 03:47:07 -03:00
|
|
|
self.assertEqual(0 << (1 << 1000), 0)
|
|
|
|
with self.assertRaises(ValueError):
|
|
|
|
0 << -(1 << 1000)
|
2016-08-29 15:27:06 -03:00
|
|
|
|
|
|
|
@support.cpython_only
|
|
|
|
def test_huge_lshift_of_zero(self):
|
|
|
|
# Shouldn't try to allocate memory for a huge shift. See issue #27870.
|
|
|
|
# Other implementations may have a different boundary for overflow,
|
|
|
|
# or not raise at all.
|
|
|
|
self.assertEqual(0 << sys.maxsize, 0)
|
2017-03-30 03:47:07 -03:00
|
|
|
self.assertEqual(0 << (sys.maxsize + 1), 0)
|
|
|
|
|
|
|
|
@support.cpython_only
|
|
|
|
@support.bigmemtest(sys.maxsize + 1000, memuse=2/15 * 2, dry_run=False)
|
|
|
|
def test_huge_lshift(self, size):
|
|
|
|
self.assertEqual(1 << (sys.maxsize + 1000), 1 << 1000 << sys.maxsize)
|
|
|
|
|
|
|
|
def test_huge_rshift(self):
|
|
|
|
self.assertEqual(42 >> (1 << 1000), 0)
|
|
|
|
self.assertEqual((-42) >> (1 << 1000), -1)
|
|
|
|
|
|
|
|
@support.cpython_only
|
|
|
|
@support.bigmemtest(sys.maxsize + 500, memuse=2/15, dry_run=False)
|
|
|
|
def test_huge_rshift_of_huge(self, size):
|
|
|
|
huge = ((1 << 500) + 11) << sys.maxsize
|
|
|
|
self.assertEqual(huge >> (sys.maxsize + 1), (1 << 499) + 5)
|
|
|
|
self.assertEqual(huge >> (sys.maxsize + 1000), 0)
|
2016-08-29 15:27:06 -03:00
|
|
|
|
2019-11-26 03:54:49 -04:00
|
|
|
@support.cpython_only
|
|
|
|
def test_small_ints_in_huge_calculation(self):
|
|
|
|
a = 2 ** 100
|
|
|
|
b = -a + 1
|
|
|
|
c = a + 1
|
|
|
|
self.assertIs(a + b, 1)
|
|
|
|
self.assertIs(c - a, 1)
|
|
|
|
|
2008-07-24 15:57:11 -03:00
|
|
|
def test_small_ints(self):
|
|
|
|
for i in range(-5, 257):
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(i, i + 0)
|
|
|
|
self.assertIs(i, i * 1)
|
|
|
|
self.assertIs(i, i - 0)
|
|
|
|
self.assertIs(i, i // 1)
|
|
|
|
self.assertIs(i, i & -1)
|
|
|
|
self.assertIs(i, i | 0)
|
|
|
|
self.assertIs(i, i ^ 0)
|
|
|
|
self.assertIs(i, ~~i)
|
|
|
|
self.assertIs(i, i**1)
|
|
|
|
self.assertIs(i, int(str(i)))
|
|
|
|
self.assertIs(i, i<<2>>2, str(i))
|
2008-07-24 15:57:11 -03:00
|
|
|
# corner cases
|
|
|
|
i = 1 << 70
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(i - i, 0)
|
|
|
|
self.assertIs(0 * i, 0)
|
2008-07-24 15:57:11 -03:00
|
|
|
|
2008-12-17 12:19:07 -04:00
|
|
|
def test_bit_length(self):
|
|
|
|
tiny = 1e-10
|
|
|
|
for x in range(-65000, 65000):
|
|
|
|
k = x.bit_length()
|
|
|
|
# Check equivalence with Python version
|
|
|
|
self.assertEqual(k, len(bin(x).lstrip('-0b')))
|
|
|
|
# Behaviour as specified in the docs
|
|
|
|
if x != 0:
|
2009-06-30 20:06:06 -03:00
|
|
|
self.assertTrue(2**(k-1) <= abs(x) < 2**k)
|
2008-12-17 12:19:07 -04:00
|
|
|
else:
|
|
|
|
self.assertEqual(k, 0)
|
|
|
|
# Alternative definition: x.bit_length() == 1 + floor(log_2(x))
|
|
|
|
if x != 0:
|
|
|
|
# When x is an exact power of 2, numeric errors can
|
|
|
|
# cause floor(log(x)/log(2)) to be one too small; for
|
|
|
|
# small x this can be fixed by adding a small quantity
|
|
|
|
# to the quotient before taking the floor.
|
|
|
|
self.assertEqual(k, 1 + math.floor(
|
|
|
|
math.log(abs(x))/math.log(2) + tiny))
|
|
|
|
|
|
|
|
self.assertEqual((0).bit_length(), 0)
|
|
|
|
self.assertEqual((1).bit_length(), 1)
|
|
|
|
self.assertEqual((-1).bit_length(), 1)
|
|
|
|
self.assertEqual((2).bit_length(), 2)
|
|
|
|
self.assertEqual((-2).bit_length(), 2)
|
|
|
|
for i in [2, 3, 15, 16, 17, 31, 32, 33, 63, 64, 234]:
|
|
|
|
a = 2**i
|
|
|
|
self.assertEqual((a-1).bit_length(), i)
|
|
|
|
self.assertEqual((1-a).bit_length(), i)
|
|
|
|
self.assertEqual((a).bit_length(), i+1)
|
|
|
|
self.assertEqual((-a).bit_length(), i+1)
|
|
|
|
self.assertEqual((a+1).bit_length(), i+1)
|
|
|
|
self.assertEqual((-a-1).bit_length(), i+1)
|
|
|
|
|
2009-01-28 17:25:58 -04:00
|
|
|
def test_round(self):
|
|
|
|
# check round-half-even algorithm. For round to nearest ten;
|
|
|
|
# rounding map is invariant under adding multiples of 20
|
|
|
|
test_dict = {0:0, 1:0, 2:0, 3:0, 4:0, 5:0,
|
|
|
|
6:10, 7:10, 8:10, 9:10, 10:10, 11:10, 12:10, 13:10, 14:10,
|
|
|
|
15:20, 16:20, 17:20, 18:20, 19:20}
|
|
|
|
for offset in range(-520, 520, 20):
|
|
|
|
for k, v in test_dict.items():
|
|
|
|
got = round(k+offset, -1)
|
|
|
|
expected = v+offset
|
|
|
|
self.assertEqual(got, expected)
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(type(got), int)
|
2009-01-28 17:25:58 -04:00
|
|
|
|
|
|
|
# larger second argument
|
|
|
|
self.assertEqual(round(-150, -2), -200)
|
|
|
|
self.assertEqual(round(-149, -2), -100)
|
|
|
|
self.assertEqual(round(-51, -2), -100)
|
|
|
|
self.assertEqual(round(-50, -2), 0)
|
|
|
|
self.assertEqual(round(-49, -2), 0)
|
|
|
|
self.assertEqual(round(-1, -2), 0)
|
|
|
|
self.assertEqual(round(0, -2), 0)
|
|
|
|
self.assertEqual(round(1, -2), 0)
|
|
|
|
self.assertEqual(round(49, -2), 0)
|
|
|
|
self.assertEqual(round(50, -2), 0)
|
|
|
|
self.assertEqual(round(51, -2), 100)
|
|
|
|
self.assertEqual(round(149, -2), 100)
|
|
|
|
self.assertEqual(round(150, -2), 200)
|
|
|
|
self.assertEqual(round(250, -2), 200)
|
|
|
|
self.assertEqual(round(251, -2), 300)
|
|
|
|
self.assertEqual(round(172500, -3), 172000)
|
|
|
|
self.assertEqual(round(173500, -3), 174000)
|
|
|
|
self.assertEqual(round(31415926535, -1), 31415926540)
|
|
|
|
self.assertEqual(round(31415926535, -2), 31415926500)
|
|
|
|
self.assertEqual(round(31415926535, -3), 31415927000)
|
|
|
|
self.assertEqual(round(31415926535, -4), 31415930000)
|
|
|
|
self.assertEqual(round(31415926535, -5), 31415900000)
|
|
|
|
self.assertEqual(round(31415926535, -6), 31416000000)
|
|
|
|
self.assertEqual(round(31415926535, -7), 31420000000)
|
|
|
|
self.assertEqual(round(31415926535, -8), 31400000000)
|
|
|
|
self.assertEqual(round(31415926535, -9), 31000000000)
|
|
|
|
self.assertEqual(round(31415926535, -10), 30000000000)
|
|
|
|
self.assertEqual(round(31415926535, -11), 0)
|
|
|
|
self.assertEqual(round(31415926535, -12), 0)
|
|
|
|
self.assertEqual(round(31415926535, -999), 0)
|
|
|
|
|
|
|
|
# should get correct results even for huge inputs
|
|
|
|
for k in range(10, 100):
|
|
|
|
got = round(10**k + 324678, -3)
|
|
|
|
expect = 10**k + 325000
|
|
|
|
self.assertEqual(got, expect)
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(type(got), int)
|
2009-01-28 17:25:58 -04:00
|
|
|
|
|
|
|
# nonnegative second argument: round(x, n) should just return x
|
|
|
|
for n in range(5):
|
|
|
|
for i in range(100):
|
|
|
|
x = random.randrange(-10000, 10000)
|
|
|
|
got = round(x, n)
|
|
|
|
self.assertEqual(got, x)
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(type(got), int)
|
2009-01-28 17:25:58 -04:00
|
|
|
for huge_n in 2**31-1, 2**31, 2**63-1, 2**63, 2**100, 10**100:
|
|
|
|
self.assertEqual(round(8979323, huge_n), 8979323)
|
|
|
|
|
|
|
|
# omitted second argument
|
|
|
|
for i in range(100):
|
|
|
|
x = random.randrange(-10000, 10000)
|
|
|
|
got = round(x)
|
|
|
|
self.assertEqual(got, x)
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(type(got), int)
|
2009-01-28 17:25:58 -04:00
|
|
|
|
|
|
|
# bad second argument
|
2016-09-03 05:55:11 -03:00
|
|
|
bad_exponents = ('brian', 2.0, 0j)
|
2009-01-28 17:25:58 -04:00
|
|
|
for e in bad_exponents:
|
|
|
|
self.assertRaises(TypeError, round, 3, e)
|
|
|
|
|
2010-01-09 16:35:09 -04:00
|
|
|
def test_to_bytes(self):
|
|
|
|
def check(tests, byteorder, signed=False):
|
|
|
|
for test, expected in tests.items():
|
|
|
|
try:
|
|
|
|
self.assertEqual(
|
|
|
|
test.to_bytes(len(expected), byteorder, signed=signed),
|
|
|
|
expected)
|
|
|
|
except Exception as err:
|
|
|
|
raise AssertionError(
|
|
|
|
"failed to convert {0} with byteorder={1} and signed={2}"
|
|
|
|
.format(test, byteorder, signed)) from err
|
|
|
|
|
|
|
|
# Convert integers to signed big-endian byte arrays.
|
|
|
|
tests1 = {
|
|
|
|
0: b'\x00',
|
|
|
|
1: b'\x01',
|
|
|
|
-1: b'\xff',
|
|
|
|
-127: b'\x81',
|
|
|
|
-128: b'\x80',
|
|
|
|
-129: b'\xff\x7f',
|
|
|
|
127: b'\x7f',
|
|
|
|
129: b'\x00\x81',
|
|
|
|
-255: b'\xff\x01',
|
|
|
|
-256: b'\xff\x00',
|
|
|
|
255: b'\x00\xff',
|
|
|
|
256: b'\x01\x00',
|
|
|
|
32767: b'\x7f\xff',
|
|
|
|
-32768: b'\xff\x80\x00',
|
|
|
|
65535: b'\x00\xff\xff',
|
|
|
|
-65536: b'\xff\x00\x00',
|
|
|
|
-8388608: b'\x80\x00\x00'
|
|
|
|
}
|
|
|
|
check(tests1, 'big', signed=True)
|
|
|
|
|
|
|
|
# Convert integers to signed little-endian byte arrays.
|
|
|
|
tests2 = {
|
|
|
|
0: b'\x00',
|
|
|
|
1: b'\x01',
|
|
|
|
-1: b'\xff',
|
|
|
|
-127: b'\x81',
|
|
|
|
-128: b'\x80',
|
|
|
|
-129: b'\x7f\xff',
|
|
|
|
127: b'\x7f',
|
|
|
|
129: b'\x81\x00',
|
|
|
|
-255: b'\x01\xff',
|
|
|
|
-256: b'\x00\xff',
|
|
|
|
255: b'\xff\x00',
|
|
|
|
256: b'\x00\x01',
|
|
|
|
32767: b'\xff\x7f',
|
|
|
|
-32768: b'\x00\x80',
|
|
|
|
65535: b'\xff\xff\x00',
|
|
|
|
-65536: b'\x00\x00\xff',
|
|
|
|
-8388608: b'\x00\x00\x80'
|
|
|
|
}
|
|
|
|
check(tests2, 'little', signed=True)
|
|
|
|
|
|
|
|
# Convert integers to unsigned big-endian byte arrays.
|
|
|
|
tests3 = {
|
|
|
|
0: b'\x00',
|
|
|
|
1: b'\x01',
|
|
|
|
127: b'\x7f',
|
|
|
|
128: b'\x80',
|
|
|
|
255: b'\xff',
|
|
|
|
256: b'\x01\x00',
|
|
|
|
32767: b'\x7f\xff',
|
|
|
|
32768: b'\x80\x00',
|
|
|
|
65535: b'\xff\xff',
|
|
|
|
65536: b'\x01\x00\x00'
|
|
|
|
}
|
|
|
|
check(tests3, 'big', signed=False)
|
|
|
|
|
|
|
|
# Convert integers to unsigned little-endian byte arrays.
|
|
|
|
tests4 = {
|
|
|
|
0: b'\x00',
|
|
|
|
1: b'\x01',
|
|
|
|
127: b'\x7f',
|
|
|
|
128: b'\x80',
|
|
|
|
255: b'\xff',
|
|
|
|
256: b'\x00\x01',
|
|
|
|
32767: b'\xff\x7f',
|
|
|
|
32768: b'\x00\x80',
|
|
|
|
65535: b'\xff\xff',
|
|
|
|
65536: b'\x00\x00\x01'
|
|
|
|
}
|
|
|
|
check(tests4, 'little', signed=False)
|
|
|
|
|
|
|
|
self.assertRaises(OverflowError, (256).to_bytes, 1, 'big', signed=False)
|
|
|
|
self.assertRaises(OverflowError, (256).to_bytes, 1, 'big', signed=True)
|
|
|
|
self.assertRaises(OverflowError, (256).to_bytes, 1, 'little', signed=False)
|
|
|
|
self.assertRaises(OverflowError, (256).to_bytes, 1, 'little', signed=True)
|
2013-03-25 21:14:08 -03:00
|
|
|
self.assertRaises(OverflowError, (-1).to_bytes, 2, 'big', signed=False)
|
2010-01-09 16:35:09 -04:00
|
|
|
self.assertRaises(OverflowError, (-1).to_bytes, 2, 'little', signed=False)
|
|
|
|
self.assertEqual((0).to_bytes(0, 'big'), b'')
|
|
|
|
self.assertEqual((1).to_bytes(5, 'big'), b'\x00\x00\x00\x00\x01')
|
|
|
|
self.assertEqual((0).to_bytes(5, 'big'), b'\x00\x00\x00\x00\x00')
|
|
|
|
self.assertEqual((-1).to_bytes(5, 'big', signed=True),
|
|
|
|
b'\xff\xff\xff\xff\xff')
|
|
|
|
self.assertRaises(OverflowError, (1).to_bytes, 0, 'big')
|
|
|
|
|
|
|
|
def test_from_bytes(self):
|
|
|
|
def check(tests, byteorder, signed=False):
|
|
|
|
for test, expected in tests.items():
|
|
|
|
try:
|
|
|
|
self.assertEqual(
|
|
|
|
int.from_bytes(test, byteorder, signed=signed),
|
|
|
|
expected)
|
|
|
|
except Exception as err:
|
|
|
|
raise AssertionError(
|
|
|
|
"failed to convert {0} with byteorder={1!r} and signed={2}"
|
|
|
|
.format(test, byteorder, signed)) from err
|
|
|
|
|
|
|
|
# Convert signed big-endian byte arrays to integers.
|
|
|
|
tests1 = {
|
|
|
|
b'': 0,
|
|
|
|
b'\x00': 0,
|
|
|
|
b'\x00\x00': 0,
|
|
|
|
b'\x01': 1,
|
|
|
|
b'\x00\x01': 1,
|
|
|
|
b'\xff': -1,
|
|
|
|
b'\xff\xff': -1,
|
|
|
|
b'\x81': -127,
|
|
|
|
b'\x80': -128,
|
|
|
|
b'\xff\x7f': -129,
|
|
|
|
b'\x7f': 127,
|
|
|
|
b'\x00\x81': 129,
|
|
|
|
b'\xff\x01': -255,
|
|
|
|
b'\xff\x00': -256,
|
|
|
|
b'\x00\xff': 255,
|
|
|
|
b'\x01\x00': 256,
|
|
|
|
b'\x7f\xff': 32767,
|
|
|
|
b'\x80\x00': -32768,
|
|
|
|
b'\x00\xff\xff': 65535,
|
|
|
|
b'\xff\x00\x00': -65536,
|
|
|
|
b'\x80\x00\x00': -8388608
|
|
|
|
}
|
|
|
|
check(tests1, 'big', signed=True)
|
|
|
|
|
|
|
|
# Convert signed little-endian byte arrays to integers.
|
|
|
|
tests2 = {
|
|
|
|
b'': 0,
|
|
|
|
b'\x00': 0,
|
|
|
|
b'\x00\x00': 0,
|
|
|
|
b'\x01': 1,
|
|
|
|
b'\x00\x01': 256,
|
|
|
|
b'\xff': -1,
|
|
|
|
b'\xff\xff': -1,
|
|
|
|
b'\x81': -127,
|
|
|
|
b'\x80': -128,
|
|
|
|
b'\x7f\xff': -129,
|
|
|
|
b'\x7f': 127,
|
|
|
|
b'\x81\x00': 129,
|
|
|
|
b'\x01\xff': -255,
|
|
|
|
b'\x00\xff': -256,
|
|
|
|
b'\xff\x00': 255,
|
|
|
|
b'\x00\x01': 256,
|
|
|
|
b'\xff\x7f': 32767,
|
|
|
|
b'\x00\x80': -32768,
|
|
|
|
b'\xff\xff\x00': 65535,
|
|
|
|
b'\x00\x00\xff': -65536,
|
|
|
|
b'\x00\x00\x80': -8388608
|
|
|
|
}
|
|
|
|
check(tests2, 'little', signed=True)
|
|
|
|
|
|
|
|
# Convert unsigned big-endian byte arrays to integers.
|
|
|
|
tests3 = {
|
|
|
|
b'': 0,
|
|
|
|
b'\x00': 0,
|
|
|
|
b'\x01': 1,
|
|
|
|
b'\x7f': 127,
|
|
|
|
b'\x80': 128,
|
|
|
|
b'\xff': 255,
|
|
|
|
b'\x01\x00': 256,
|
|
|
|
b'\x7f\xff': 32767,
|
|
|
|
b'\x80\x00': 32768,
|
|
|
|
b'\xff\xff': 65535,
|
|
|
|
b'\x01\x00\x00': 65536,
|
|
|
|
}
|
|
|
|
check(tests3, 'big', signed=False)
|
|
|
|
|
|
|
|
# Convert integers to unsigned little-endian byte arrays.
|
|
|
|
tests4 = {
|
|
|
|
b'': 0,
|
|
|
|
b'\x00': 0,
|
|
|
|
b'\x01': 1,
|
|
|
|
b'\x7f': 127,
|
|
|
|
b'\x80': 128,
|
|
|
|
b'\xff': 255,
|
|
|
|
b'\x00\x01': 256,
|
|
|
|
b'\xff\x7f': 32767,
|
|
|
|
b'\x00\x80': 32768,
|
|
|
|
b'\xff\xff': 65535,
|
|
|
|
b'\x00\x00\x01': 65536,
|
|
|
|
}
|
|
|
|
check(tests4, 'little', signed=False)
|
|
|
|
|
|
|
|
class myint(int):
|
|
|
|
pass
|
|
|
|
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(type(myint.from_bytes(b'\x00', 'big')), myint)
|
2010-01-09 16:35:09 -04:00
|
|
|
self.assertEqual(myint.from_bytes(b'\x01', 'big'), 1)
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(
|
|
|
|
type(myint.from_bytes(b'\x00', 'big', signed=False)), myint)
|
2010-01-09 16:35:09 -04:00
|
|
|
self.assertEqual(myint.from_bytes(b'\x01', 'big', signed=False), 1)
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(type(myint.from_bytes(b'\x00', 'little')), myint)
|
2010-01-09 16:35:09 -04:00
|
|
|
self.assertEqual(myint.from_bytes(b'\x01', 'little'), 1)
|
2014-02-08 08:28:33 -04:00
|
|
|
self.assertIs(type(myint.from_bytes(
|
|
|
|
b'\x00', 'little', signed=False)), myint)
|
2010-01-09 16:35:09 -04:00
|
|
|
self.assertEqual(myint.from_bytes(b'\x01', 'little', signed=False), 1)
|
|
|
|
self.assertEqual(
|
|
|
|
int.from_bytes([255, 0, 0], 'big', signed=True), -65536)
|
|
|
|
self.assertEqual(
|
|
|
|
int.from_bytes((255, 0, 0), 'big', signed=True), -65536)
|
|
|
|
self.assertEqual(int.from_bytes(
|
|
|
|
bytearray(b'\xff\x00\x00'), 'big', signed=True), -65536)
|
|
|
|
self.assertEqual(int.from_bytes(
|
|
|
|
bytearray(b'\xff\x00\x00'), 'big', signed=True), -65536)
|
|
|
|
self.assertEqual(int.from_bytes(
|
|
|
|
array.array('B', b'\xff\x00\x00'), 'big', signed=True), -65536)
|
|
|
|
self.assertEqual(int.from_bytes(
|
|
|
|
memoryview(b'\xff\x00\x00'), 'big', signed=True), -65536)
|
|
|
|
self.assertRaises(ValueError, int.from_bytes, [256], 'big')
|
|
|
|
self.assertRaises(ValueError, int.from_bytes, [0], 'big\x00')
|
|
|
|
self.assertRaises(ValueError, int.from_bytes, [0], 'little\x00')
|
|
|
|
self.assertRaises(TypeError, int.from_bytes, "", 'big')
|
|
|
|
self.assertRaises(TypeError, int.from_bytes, "\x00", 'big')
|
|
|
|
self.assertRaises(TypeError, int.from_bytes, 0, 'big')
|
|
|
|
self.assertRaises(TypeError, int.from_bytes, 0, 'big', True)
|
|
|
|
self.assertRaises(TypeError, myint.from_bytes, "", 'big')
|
|
|
|
self.assertRaises(TypeError, myint.from_bytes, "\x00", 'big')
|
|
|
|
self.assertRaises(TypeError, myint.from_bytes, 0, 'big')
|
|
|
|
self.assertRaises(TypeError, int.from_bytes, 0, 'big', True)
|
2009-01-28 17:25:58 -04:00
|
|
|
|
2016-05-12 04:37:58 -03:00
|
|
|
class myint2(int):
|
|
|
|
def __new__(cls, value):
|
|
|
|
return int.__new__(cls, value + 1)
|
|
|
|
|
|
|
|
i = myint2.from_bytes(b'\x01', 'big')
|
|
|
|
self.assertIs(type(i), myint2)
|
|
|
|
self.assertEqual(i, 2)
|
|
|
|
|
|
|
|
class myint3(int):
|
|
|
|
def __init__(self, value):
|
|
|
|
self.foo = 'bar'
|
|
|
|
|
|
|
|
i = myint3.from_bytes(b'\x01', 'big')
|
|
|
|
self.assertIs(type(i), myint3)
|
|
|
|
self.assertEqual(i, 1)
|
|
|
|
self.assertEqual(getattr(i, 'foo', 'none'), 'bar')
|
|
|
|
|
2012-04-20 17:42:49 -03:00
|
|
|
def test_access_to_nonexistent_digit_0(self):
|
|
|
|
# http://bugs.python.org/issue14630: A bug in _PyLong_Copy meant that
|
|
|
|
# ob_digit[0] was being incorrectly accessed for instances of a
|
|
|
|
# subclass of int, with value 0.
|
|
|
|
class Integer(int):
|
|
|
|
def __new__(cls, value=0):
|
|
|
|
self = int.__new__(cls, value)
|
|
|
|
self.foo = 'foo'
|
|
|
|
return self
|
|
|
|
|
|
|
|
integers = [Integer(0) for i in range(1000)]
|
|
|
|
for n in map(int, integers):
|
|
|
|
self.assertEqual(n, 0)
|
|
|
|
|
2014-05-12 17:35:40 -03:00
|
|
|
def test_shift_bool(self):
|
|
|
|
# Issue #21422: ensure that bool << int and bool >> int return int
|
|
|
|
for value in (True, False):
|
|
|
|
for shift in (0, 2):
|
|
|
|
self.assertEqual(type(value << shift), int)
|
|
|
|
self.assertEqual(type(value >> shift), int)
|
|
|
|
|
2018-09-14 03:56:23 -03:00
|
|
|
def test_as_integer_ratio(self):
|
2018-10-19 18:46:31 -03:00
|
|
|
class myint(int):
|
|
|
|
pass
|
|
|
|
tests = [10, 0, -10, 1, sys.maxsize + 1, True, False, myint(42)]
|
2018-09-14 03:56:23 -03:00
|
|
|
for value in tests:
|
|
|
|
numerator, denominator = value.as_integer_ratio()
|
2018-10-19 18:46:31 -03:00
|
|
|
self.assertEqual((numerator, denominator), (int(value), 1))
|
|
|
|
self.assertEqual(type(numerator), int)
|
|
|
|
self.assertEqual(type(denominator), int)
|
2018-09-14 03:56:23 -03:00
|
|
|
|
2008-12-17 12:19:07 -04:00
|
|
|
|
2005-06-13 18:44:48 -03:00
|
|
|
if __name__ == "__main__":
|
2015-04-13 17:00:43 -03:00
|
|
|
unittest.main()
|