Commit Graph

3048 Commits

Author SHA1 Message Date
Raymond Hettinger b0d56afc84 Give dict views a helpful __repr__. 2009-03-03 10:52:49 +00:00
Mark Dickinson 134708ab14 Merged revisions 69974 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69974 | mark.dickinson | 2009-02-25 20:29:50 +0000 (Wed, 25 Feb 2009) | 3 lines

  Replace long with twodigits, to avoid depending
  on sizeof(digit) < sizeof(long)
........
2009-02-25 20:33:49 +00:00
Mark Dickinson 934896dc09 Merged revisions 69846 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69846 | mark.dickinson | 2009-02-21 20:27:01 +0000 (Sat, 21 Feb 2009) | 2 lines

  Issue #5341: Fix a variety of spelling errors.
........
2009-02-21 20:59:32 +00:00
Eric Smith 5e5c0db5d7 Merged revisions 69806 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69806 | eric.smith | 2009-02-20 09:02:36 -0500 (Fri, 20 Feb 2009) | 1 line

  Issue #5247: Improve error message when unknown format codes are used when using str.format() with str, int, and float arguments.
........
2009-02-20 14:25:03 +00:00
Benjamin Peterson d75fcb4ddf Merged revisions 69576,69579-69580,69589,69619-69620,69633,69703-69704,69728-69730 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69576 | georg.brandl | 2009-02-13 04:56:50 -0600 (Fri, 13 Feb 2009) | 1 line

  #1661108: note that urlsafe encoded string can contain "=".
........
  r69579 | georg.brandl | 2009-02-13 05:06:59 -0600 (Fri, 13 Feb 2009) | 2 lines

  Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
........
  r69580 | georg.brandl | 2009-02-13 05:10:04 -0600 (Fri, 13 Feb 2009) | 2 lines

  Fix warnings GCC emits where the argument of PyErr_Format is a single variable.
........
  r69589 | martin.v.loewis | 2009-02-13 14:11:34 -0600 (Fri, 13 Feb 2009) | 2 lines

  Move amd64 properties further to the top, so that they override
  the linker options correctly.
........
  r69619 | benjamin.peterson | 2009-02-14 11:00:51 -0600 (Sat, 14 Feb 2009) | 1 line

  this needn't be a shebang line
........
  r69620 | georg.brandl | 2009-02-14 11:01:36 -0600 (Sat, 14 Feb 2009) | 1 line

  #5179: don't leak PIPE fds when child execution fails.
........
  r69633 | hirokazu.yamamoto | 2009-02-15 03:19:48 -0600 (Sun, 15 Feb 2009) | 1 line

  Fixed typo.
........
  r69703 | raymond.hettinger | 2009-02-16 16:42:54 -0600 (Mon, 16 Feb 2009) | 3 lines

  Issue 5229: Documentation for super() neglects to say what super() actually does
........
  r69704 | raymond.hettinger | 2009-02-16 17:00:25 -0600 (Mon, 16 Feb 2009) | 1 line

  Add explanation for super(type1, type2).
........
  r69728 | georg.brandl | 2009-02-17 18:22:55 -0600 (Tue, 17 Feb 2009) | 2 lines

  #5297: fix example.
........
  r69729 | georg.brandl | 2009-02-17 18:25:13 -0600 (Tue, 17 Feb 2009) | 2 lines

  #5296: sequence -> iterable.
........
  r69730 | georg.brandl | 2009-02-17 18:31:36 -0600 (Tue, 17 Feb 2009) | 2 lines

  #5268: mention VMSError.
........
2009-02-19 04:22:03 +00:00
Mark Dickinson 0d4785bc3b Fix more places in Objects/longobject.c where it's silently assumed that
sizeof(digit) < sizeof(int).
2009-02-15 17:27:41 +00:00
Mark Dickinson e441674a96 A few more type fixes for py3k that were missed in r69635 2009-02-15 15:14:57 +00:00
Mark Dickinson 5a74bf6354 Merged revisions 69634 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69634 | mark.dickinson | 2009-02-15 10:13:41 +0000 (Sun, 15 Feb 2009) | 6 lines

  Issue #5260: Various portability and standards compliance fixes, optimizations
  and cleanups in Objects/longobject.c.  The most significant change is that
  longs now use less memory:  average savings are 2 bytes per long on 32-bit
  systems and 6 bytes per long on 64-bit systems.  (This memory saving already
  exists in py3k.)
........
2009-02-15 11:04:38 +00:00
Antoine Pitrou 79eee6ba6b Merged revisions 69582-69583 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69582 | antoine.pitrou | 2009-02-13 14:52:33 +0100 (ven., 13 févr. 2009) | 4 lines

  Issue #5186: Reduce hash collisions for objects with no __hash__ method by
  rotating the object pointer by 4 bits to the right.
........
  r69583 | antoine.pitrou | 2009-02-13 14:57:40 +0100 (ven., 13 févr. 2009) | 3 lines

  Fix compiler warning (gcc)
........
2009-02-13 14:01:05 +00:00
Benjamin Peterson f91df0465d Merged revisions 69364-69365,69409-69410,69413,69417,69435,69442,69447,69495,69519-69521 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69364 | kristjan.jonsson | 2009-02-06 04:17:34 -0600 (Fri, 06 Feb 2009) | 1 line

  Fix a number of Win32ErrorTests error cases.  chmod wasn't being tested.  'access' never raises an error.
........
  r69365 | armin.rigo | 2009-02-06 05:46:26 -0600 (Fri, 06 Feb 2009) | 2 lines

  Ivan on IRC in #twisted reported this crasher.
........
  r69409 | georg.brandl | 2009-02-07 06:21:17 -0600 (Sat, 07 Feb 2009) | 1 line

  #5174: fix wrong file closing in example.
........
  r69410 | neil.schemenauer | 2009-02-07 08:53:31 -0600 (Sat, 07 Feb 2009) | 4 lines

  Fix broken test in test_hotshot.  Treating the current directory as an
  empty file is sloppy and non-portable.  Use NamedTemporaryFile to make
  an empty file.
........
  r69413 | neil.schemenauer | 2009-02-07 12:35:16 -0600 (Sat, 07 Feb 2009) | 2 lines

  Add test for issue #999042, explict global statement works.
........
  r69417 | benjamin.peterson | 2009-02-07 17:01:19 -0600 (Sat, 07 Feb 2009) | 1 line

  document individual 2to3 fixers
........
  r69435 | benjamin.peterson | 2009-02-08 08:38:13 -0600 (Sun, 08 Feb 2009) | 1 line

  document numliterals fixer
........
  r69442 | benjamin.peterson | 2009-02-08 09:14:57 -0600 (Sun, 08 Feb 2009) | 1 line

  a few edits and typos
........
  r69447 | vinay.sajip | 2009-02-08 13:06:08 -0600 (Sun, 08 Feb 2009) | 2 lines

  Issue #5170: Fixed Unicode output bug in logging and added test case. This is a regression which did not occur in 2.5.
........
  r69495 | kristjan.jonsson | 2009-02-10 07:32:24 -0600 (Tue, 10 Feb 2009) | 1 line

  Issue 4804.  Add a function to test the validity of file descriptors on Windows, and stop using global runtime settings to silence the warnings / assertions.
........
  r69519 | gregory.p.smith | 2009-02-11 17:45:25 -0600 (Wed, 11 Feb 2009) | 3 lines

  Issue #1008086: Fixes socket.inet_aton() to always return 4 bytes even
  on LP64 platforms (most 64-bit Linux, bsd, unix systems).
........
  r69520 | benjamin.peterson | 2009-02-11 21:50:00 -0600 (Wed, 11 Feb 2009) | 1 line

  os.fsync() should be used to ensure that data is written to disk
........
  r69521 | benjamin.peterson | 2009-02-11 22:17:04 -0600 (Wed, 11 Feb 2009) | 1 line

  no need for this __bases__ trick anymore
........
2009-02-13 02:50:59 +00:00
Mark Dickinson 21776074cc Merged revisions 69498 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69498 | mark.dickinson | 2009-02-10 15:46:50 +0000 (Tue, 10 Feb 2009) | 6 lines

  Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for
  negative arguments.  Previously, it raised TypeError.

  Thanks Lisandro Dalcin.
........
2009-02-10 16:13:25 +00:00
Benjamin Peterson ee1ae7ccb7 fix len() when __len__() returns a non number type #5137 2009-02-08 21:07:20 +00:00
Mark Dickinson c96db47217 Merged revisions 69436 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69436 | mark.dickinson | 2009-02-08 14:42:28 +0000 (Sun, 08 Feb 2009) | 10 lines

  Issue #789290: make sure that hash(2**63) == hash(2.**63) on 64-bit
  platforms.  The previous code was fragile, depending on the twin
  accidents that:

    (1) in C, casting the double value 2.**63 to long returns the integer
        value -2**63, and
    (2) in Python, hash(-2**63) == hash(2**63).

  There's already a test for this in test_hash.
........
2009-02-08 15:09:21 +00:00
Benjamin Peterson 876185542d remove memoryview.__str__ #5182 2009-02-08 15:00:52 +00:00
Mark Dickinson 2a7d45b680 Issue #1717: add a DeprecationWarning in 3.x on type initialization
for types that implement tp_reserved (formerly tp_compare) but
not tp_richcompare.
2009-02-08 11:02:10 +00:00
Raymond Hettinger 5d65412d35 Validate that __length_hint__ returns a usable result. 2009-02-03 02:12:10 +00:00
Raymond Hettinger e8364233ae Issue 1242657: list(obj) can swallow KeyboardInterrupt. 2009-02-02 22:55:09 +00:00
Mark Dickinson e94c679df0 Issue #1717: rename tp_compare to tp_reserved. I'll change the
type of tp_compare in a separate commit, for ease of reversion
should things go wrong.
2009-02-02 20:36:42 +00:00
Mark Dickinson 995d4cdd62 Remove exception for non-NULL tp_compare that was introduced in r69188. 2009-02-01 20:36:08 +00:00
Mark Dickinson c008a176af Issue #1717, continued: remove PyObject_Compare and Py_CmpToRich declarations
from object.h; don't inherit tp_compare slot on subclasses; and raise TypeError
when initializing a type that has a nonzero tp_compare slot.  Fix up
comparison-related comments in object.c and code.h.
2009-02-01 13:59:22 +00:00
Mark Dickinson f02e0aaafd Issue #1717: remove the cmp builtin function, the C-API functions
PyObject_Cmp, PyObject_Compare, and various support functions.
2009-02-01 12:13:56 +00:00
Mark Dickinson 211c625829 Issue #1717, stage 2: remove uses of tp_compare in Modules and most
Objects.
2009-02-01 10:28:51 +00:00
Benjamin Peterson 29060641ca fix indentation again 2009-01-31 22:14:21 +00:00
Benjamin Peterson 14339b6d34 detabify Objects/unicodeobject.c 2009-01-31 16:36:08 +00:00
Mark Dickinson 1124e71368 Issue #4707: round(x, n) now returns an integer when x is an integer.
Previously it returned a float.
2009-01-28 21:25:58 +00:00
Mark Dickinson a5cafdf2dd Merged revisions 68974-68975 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68974 | mark.dickinson | 2009-01-26 21:36:30 +0000 (Mon, 26 Jan 2009) | 4 lines

  Fix undefined behaviour (left shift of negative value) in long_hash.  Also,
  rewrap a line of length > 79, and update comments.
........
  r68975 | mark.dickinson | 2009-01-26 21:40:08 +0000 (Mon, 26 Jan 2009) | 2 lines

  Fix comment.
........
2009-01-26 21:56:07 +00:00
Mark Dickinson 1e2d8700d6 Merged revisions 68947 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68947 | mark.dickinson | 2009-01-25 22:12:31 +0000 (Sun, 25 Jan 2009) | 3 lines

  No need for carry to be type twodigits in _PyLong_AsByteArray; digit is large enough.
  This change should silence a compiler warning on Windows.
........
2009-01-25 22:25:06 +00:00
Mark Dickinson 17e5587693 Merged revisions 68890 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68890 | mark.dickinson | 2009-01-24 15:27:44 +0000 (Sat, 24 Jan 2009) | 6 lines

  Issue #4393: fix 3 classes of potential portability problems in longobject.c:
   - fix some places where counters into ob_digit were declared as
     int instead of Py_ssize_t
   - add (twodigit) casts where necessary
   - fix code in _PyLong_AsByteArray that uses << on negative values
........
2009-01-24 15:56:57 +00:00
Mark Dickinson d4624c3331 Some minor cleanups in PyLong_FromLong:
- fast path wasn't being properly taken for negative ints;
   thanks Victor Stinner for pointing this out.
 - use Py_SAFE_DOWNCAST instead of direct casting to digit
   (it's safer, especially if we ever consider moving to 30-bit
   digits)
 - cleaner way to write negation
2009-01-24 15:02:35 +00:00
Benjamin Peterson aa06900347 Merged revisions 68750,68776-68777,68811,68842,68859 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68750 | benjamin.peterson | 2009-01-18 16:47:04 -0600 (Sun, 18 Jan 2009) | 1 line

  fix encoding cookie case
........
  r68776 | benjamin.peterson | 2009-01-19 10:17:54 -0600 (Mon, 19 Jan 2009) | 1 line

  move BufferedIOBase into the base class section
........
  r68777 | benjamin.peterson | 2009-01-19 10:18:27 -0600 (Mon, 19 Jan 2009) | 1 line

  add email address
........
  r68811 | benjamin.peterson | 2009-01-20 12:58:27 -0600 (Tue, 20 Jan 2009) | 1 line

  fix url
........
  r68842 | andrew.kuchling | 2009-01-20 20:16:26 -0600 (Tue, 20 Jan 2009) | 1 line

  Markup fixes
........
  r68859 | georg.brandl | 2009-01-22 12:29:28 -0600 (Thu, 22 Jan 2009) | 2 lines

  Clarify wording.
........
2009-01-23 03:26:36 +00:00
Mark Dickinson 9ffc0205a6 Issue 4842, patch 2/2: int('3L') should be invalid in Python 3.x. 2009-01-20 20:45:53 +00:00
Benjamin Peterson b58dda7bdb Merged revisions 68633,68648,68667,68706,68718,68720-68721,68724-68727,68739 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68633 | thomas.heller | 2009-01-16 12:53:44 -0600 (Fri, 16 Jan 2009) | 3 lines

  Change an example in the docs to avoid a mistake when the code is copy
  pasted and changed afterwards.
........
  r68648 | benjamin.peterson | 2009-01-16 22:28:57 -0600 (Fri, 16 Jan 2009) | 1 line

  use enumerate
........
  r68667 | amaury.forgeotdarc | 2009-01-17 14:18:59 -0600 (Sat, 17 Jan 2009) | 3 lines

  #4077: No need to append \n when calling Py_FatalError
  + fix a declaration to make it match the one in pythonrun.h
........
  r68706 | benjamin.peterson | 2009-01-17 19:28:46 -0600 (Sat, 17 Jan 2009) | 1 line

  fix grammar
........
  r68718 | georg.brandl | 2009-01-18 04:42:35 -0600 (Sun, 18 Jan 2009) | 1 line

  #4976: union() and intersection() take multiple args, but talk about "the other".
........
  r68720 | georg.brandl | 2009-01-18 04:45:22 -0600 (Sun, 18 Jan 2009) | 1 line

  #4974: fix redundant mention of lists and tuples.
........
  r68721 | georg.brandl | 2009-01-18 04:48:16 -0600 (Sun, 18 Jan 2009) | 1 line

  #4914: trunc is in math.
........
  r68724 | georg.brandl | 2009-01-18 07:24:10 -0600 (Sun, 18 Jan 2009) | 1 line

  #4979: correct result range for some random functions.
........
  r68725 | georg.brandl | 2009-01-18 07:47:26 -0600 (Sun, 18 Jan 2009) | 1 line

  #4857: fix augmented assignment target spec.
........
  r68726 | georg.brandl | 2009-01-18 08:41:52 -0600 (Sun, 18 Jan 2009) | 1 line

  #4923: clarify what was added.
........
  r68727 | georg.brandl | 2009-01-18 12:25:30 -0600 (Sun, 18 Jan 2009) | 1 line

  #4986: augassigns are not expressions.
........
  r68739 | benjamin.peterson | 2009-01-18 15:11:38 -0600 (Sun, 18 Jan 2009) | 1 line

  fix test that wasn't working as expected #4990
........
2009-01-18 22:27:04 +00:00
Benjamin Peterson b547979515 Merged revisions 68568,68665 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68568 | georg.brandl | 2009-01-13 02:11:07 -0600 (Tue, 13 Jan 2009) | 2 lines

  Fix call signature and markup.
........
  r68665 | amaury.forgeotdarc | 2009-01-17 11:11:50 -0600 (Sat, 17 Jan 2009) | 3 lines

  #4930: Slightly cleaner (and faster) code in type creation:
  compare slots by address, not by name.
........
2009-01-18 22:10:38 +00:00
Mark Dickinson 17c7cd8d02 Replace PyNumber_Int with PyNumber_Long. 2009-01-17 21:57:11 +00:00
Antoine Pitrou e4bc7f69c2 Issue #4838: When a module is deallocated, free the memory backing the optional module state data. 2009-01-17 21:06:43 +00:00
Mark Dickinson 0156dabadf Remove attempted long->int conversions in py3k version of float.as_integer_ratio. 2009-01-17 10:48:28 +00:00
Mark Dickinson 8055afd019 Issue #4910, patch 3/3: rename nb_long to nb_reserved 2009-01-17 10:04:45 +00:00
Mark Dickinson cce2f217d4 Issue 4910, patch 2 of (probably) 3: pave the way for renaming of
nb_long:  remove last remaining use of nb_long
(in the struct module) from the core, set nb_long slots on all builtin
and extension types to 0, and remove uses of __long__ in test_complex
and test_binop.

Reviewed by Benjamin Peterson.
2009-01-15 19:32:23 +00:00
Antoine Pitrou 8d4e505aa8 Issue #4935: The overflow checking code in the expandtabs() method common
to str, bytes and bytearray could be optimized away by the compiler (*), letting
the interpreter segfault instead of raising an error.

(*) or at least it is our interpretation
2009-01-13 22:59:11 +00:00
Amaury Forgeot d'Arc f343e01c17 Merged revisions 68560 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68560 | amaury.forgeotdarc | 2009-01-13 00:36:55 +0100 (mar., 13 janv. 2009) | 6 lines

  #3720: Interpreter crashes when an evil iterator removes its own next function.

  Now the slot is filled with a function that always raises.

  Will not backport: extensions compiled with 2.6.x would not run on 2.6.0.
........
2009-01-12 23:58:21 +00:00
Mark Dickinson e5e298f875 Issue #4910 (1st patch of a series): fix int() and the corresponding
PyNumber_Int/PyNumber_Long API function so that it no longer attempts
to call the __long__ method for conversion.  Only the __int__ and __trunc__
methods are used.  (This removes a major remaining use of the nb_long
slot from the Python 3.x core.)

Thanks Benjamin for review.
2009-01-12 20:49:19 +00:00
Antoine Pitrou d6e8de1797 Issue #4916: fix little-endian UTF-16 decoding bug on big-endian UCS-4 builds, introduced by r68483. 2009-01-11 23:56:55 +00:00
Benjamin Peterson a4a37fefb6 Merged revisions 68381 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68381 | martin.v.loewis | 2009-01-07 12:40:40 -0600 (Wed, 07 Jan 2009) | 2 lines

  Issue #4850: Change COUNT_ALLOCS variables to Py_ssize_t.
........
2009-01-11 17:13:55 +00:00
Mark Dickinson d746768d3a Issue #4910: replace "long" with "int" in docstring for __long__ slot and
in documentation for PyNumber_Long.
2009-01-10 22:14:33 +00:00
Antoine Pitrou ab868311a5 Issue #4868: utf-8, utf-16 and latin1 decoding are now 2x to 4x faster. The
common cases are optimized thanks to a dedicated fast path and a moderate
amount of loop unrolling.

This will especially help text I/O (we already register a 30% speedup on large
reads on the io-c branch).
2009-01-10 15:40:25 +00:00
Raymond Hettinger 3563153793 Reduce the size of the _PyLong_DigitValue table. 2009-01-09 03:58:09 +00:00
Antoine Pitrou 35b7e837ab Issue #4822: fix messy indentation in memoryobject.c/.h, before we may backport it to trunk.
Reviewed on IRC by Georg Brandl, with assistance by Benjamin Peterson.
2009-01-03 19:20:36 +00:00
Antoine Pitrou c3b39245a7 Issue #4580: slicing of memoryviews when itemsize != 1 is wrong.
Also fix len() to return number of items rather than length in bytes.

I'm sorry it was not possible for me to work on this without reindenting
a bit some stuff around. The indentation in memoryobject.c is a mess,
I'll open a separate bug for it.
2009-01-03 16:59:18 +00:00
Georg Brandl 574b1279d9 Remove traces of Py_InitModule*. 2009-01-02 19:20:26 +00:00
Antoine Pitrou 7ddda7830c Merged revisions 68128 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68128 | antoine.pitrou | 2009-01-01 15:11:22 +0100 (jeu., 01 janv. 2009) | 3 lines

  Issue #3680: Reference cycles created through a dict, set or deque iterator did not get collected.
........
2009-01-01 15:35:33 +00:00