Commit Graph

3026 Commits

Author SHA1 Message Date
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
Nick Coghlan f1f2f686fe Recorded merge of revisions 68051 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r68051 | nick.coghlan | 2008-12-30 11:18:48 +1000 (Tue, 30 Dec 2008) | 1 line

  Issue #4701: implicitly call PyType_Ready from PyObject_Hash
........
2008-12-30 07:29:12 +00:00
Georg Brandl ccc47b6eee #4759: allow None as first argument of bytearray.translate(), for consistency with bytes.translate().
Also fix segfault for bytearray.translate(x, None) -- will backport this part to 3.0 and 2.6.
2008-12-28 11:44:14 +00:00
Georg Brandl 09923f3b45 Remove confusing error message in bytes.translate. 2008-12-27 23:12:09 +00:00
Alexandre Vassalotti 2056bed45e Revert unwanted function name change introduced by r67939. 2008-12-27 19:46:35 +00:00
Hirokazu Yamamoto d88e8fab14 Fixed incompatible pointer warning. 2008-12-27 14:58:17 +00:00
Alexandre Vassalotti bad1b9219b Fix bogus assertion. 2008-12-27 09:49:09 +00:00
Alexandre Vassalotti 44531cb2db Optimize built-in unicode codecs by avoiding unnecessary copying.
The approach used is similiar to what is currently used in the version
of unicodeobject.c in Python 2.x. The only difference is we use
_PyBytes_Resize instead of _PyString_Resize.
2008-12-27 09:16:49 +00:00
Alexandre Vassalotti 9cb6f7f7a5 Fix wrong bytes type conversion in PyUnicode_AsUnicodeEscapeString.
Fix wrong bytes type conversion in PyUnicode_AsUnicodeDecodeString.
2008-12-27 09:09:15 +00:00
Alexandre Vassalotti aa0e531ede Merged revisions 67932 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67932 | alexandre.vassalotti | 2008-12-27 01:36:10 -0500 (Sat, 27 Dec 2008) | 5 lines

  Remove unnecessary casts related to unicode_decode_call_errorhandler.
  Make the _PyUnicode_Resize macro a static function.

  These changes are needed to avoid breaking strict aliasing rules.
........
2008-12-27 06:43:58 +00:00
Benjamin Peterson 6ebe78f5cc Merged revisions 67654,67676-67677,67681,67692,67725,67761,67784-67785,67787-67788,67802,67848-67850,67862-67864,67880,67882 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67654 | georg.brandl | 2008-12-07 16:42:09 -0600 (Sun, 07 Dec 2008) | 2 lines

  #4457: rewrite __import__() documentation.
........
  r67676 | benjamin.peterson | 2008-12-08 20:03:03 -0600 (Mon, 08 Dec 2008) | 1 line

  specify how things are copied
........
  r67677 | benjamin.peterson | 2008-12-08 20:05:11 -0600 (Mon, 08 Dec 2008) | 1 line

  revert unrelated change to installer script
........
  r67681 | jeremy.hylton | 2008-12-09 15:03:10 -0600 (Tue, 09 Dec 2008) | 2 lines

  Add simple unittests for Request
........
  r67692 | amaury.forgeotdarc | 2008-12-10 18:03:42 -0600 (Wed, 10 Dec 2008) | 2 lines

  #1030250: correctly pass the dry_run option to the mkpath() function.
........
  r67725 | benjamin.peterson | 2008-12-12 22:02:20 -0600 (Fri, 12 Dec 2008) | 1 line

  fix incorrect example
........
  r67761 | benjamin.peterson | 2008-12-14 11:26:04 -0600 (Sun, 14 Dec 2008) | 1 line

  fix missing bracket
........
  r67784 | georg.brandl | 2008-12-15 02:33:58 -0600 (Mon, 15 Dec 2008) | 2 lines

  #4446: document "platforms" argument for setup().
........
  r67785 | georg.brandl | 2008-12-15 02:36:11 -0600 (Mon, 15 Dec 2008) | 2 lines

  #4611: fix typo.
........
  r67787 | georg.brandl | 2008-12-15 02:58:59 -0600 (Mon, 15 Dec 2008) | 2 lines

  #4578: fix has_key() usage in compiler package.
........
  r67788 | georg.brandl | 2008-12-15 03:07:39 -0600 (Mon, 15 Dec 2008) | 2 lines

  #4568: remove limitation in varargs callback example.
........
  r67802 | amaury.forgeotdarc | 2008-12-15 16:29:14 -0600 (Mon, 15 Dec 2008) | 4 lines

  #3632: the "pyo" macro from gdbinit can now run when the GIL is released.

  Patch by haypo.
........
  r67848 | benjamin.peterson | 2008-12-18 20:28:56 -0600 (Thu, 18 Dec 2008) | 1 line

  fix typo
........
  r67849 | benjamin.peterson | 2008-12-18 20:31:35 -0600 (Thu, 18 Dec 2008) | 1 line

  _call_method -> _callmethod and _get_value to _getvalue
........
  r67850 | raymond.hettinger | 2008-12-19 03:06:07 -0600 (Fri, 19 Dec 2008) | 9 lines

  Fix-up and clean-up docs for int.bit_length().

  * Replace dramatic footnote with in-line comment about possible round-off errors in logarithms of large numbers.
  * Add comments to the pure python code equivalent.
  * replace floor() with int() in the mathematical equivalent so the type is correct (should be an int, not a float).
  * add abs() to the mathematical equivalent so that it matches the previous line that it is supposed to be equivalent to.
  * make one combined example with a negative input.
........
  r67862 | benjamin.peterson | 2008-12-19 20:48:02 -0600 (Fri, 19 Dec 2008) | 1 line

  copy sentence from docstring
........
  r67863 | benjamin.peterson | 2008-12-19 20:51:26 -0600 (Fri, 19 Dec 2008) | 1 line

  add headings
........
  r67864 | benjamin.peterson | 2008-12-19 20:57:19 -0600 (Fri, 19 Dec 2008) | 1 line

  beef up docstring
........
  r67880 | benjamin.peterson | 2008-12-20 16:49:24 -0600 (Sat, 20 Dec 2008) | 1 line

  remove redundant sentence
........
  r67882 | benjamin.peterson | 2008-12-20 16:59:49 -0600 (Sat, 20 Dec 2008) | 1 line

  add some recent releases to the list
........
2008-12-21 00:06:59 +00:00
Antoine Pitrou 51f3ef9da0 Issue #3106: Speedup some comparisons. This also removes the last call
to Py_CmpToRich from the codebase (in longobject.c).
2008-12-20 13:14:23 +00:00
Kristján Valur Jónsson baa4546b02 Add missing Py_CHARMASK when calling isspace().
Found by enabling runtime tests on windows, by disabling the _set_invalid_parameter_handler() fiddling.
2008-12-18 17:08:57 +00:00
Mark Dickinson 54bc1ec4c7 Forward merge of r67822 to py3k: add bit_length method to int. 2008-12-17 16:19:07 +00:00
Antoine Pitrou bc420400eb Issue #4569: Interpreter crash when mutating a memoryview with an item size larger than 1.
(together with a bit of reindenting)
2008-12-07 20:14:49 +00:00
Antoine Pitrou 5504e893f8 Issue #4509: bugs in bytearray with exports (buffer protocol) 2008-12-06 21:27:53 +00:00
Mark Dickinson fd24b323f9 Issue #4445: save 3 bytes of memory (on average) per bytes allocation.
(This is a forward port of r67601).
2008-12-06 15:33:31 +00:00
Mark Dickinson 50b2b6eeac Issue 4497: silence compiler warnings on Windows. 2008-12-05 17:14:29 +00:00
Raymond Hettinger f5b64116cc Issue 3689: list_reverseiterator should support __length_hint__ instead of __len__. 2008-12-02 21:33:45 +00:00
Raymond Hettinger 2212e529d9 Update copyright for recent changes. 2008-11-30 23:43:36 +00:00
Benjamin Peterson 4469d0ca56 Merged revisions 67348,67355,67359,67362,67364-67365,67367-67368,67398,67423-67424,67432,67440-67441,67444-67445,67454-67455,67457-67458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67348 | benjamin.peterson | 2008-11-22 20:09:41 -0600 (Sat, 22 Nov 2008) | 1 line

  raise a better error
........
  r67355 | georg.brandl | 2008-11-23 13:17:25 -0600 (Sun, 23 Nov 2008) | 2 lines

  #4392: fix parameter name.
........
  r67359 | georg.brandl | 2008-11-23 15:57:30 -0600 (Sun, 23 Nov 2008) | 2 lines

  #4399: fix typo.
........
  r67362 | gregory.p.smith | 2008-11-23 18:41:43 -0600 (Sun, 23 Nov 2008) | 2 lines

  Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple.
........
  r67364 | benjamin.peterson | 2008-11-23 19:16:29 -0600 (Sun, 23 Nov 2008) | 2 lines

  replace reference to debugger-hooks
........
  r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line

  #4396 make the parser module correctly validate the with syntax
........
  r67367 | georg.brandl | 2008-11-24 10:16:07 -0600 (Mon, 24 Nov 2008) | 2 lines

  Fix typo.
........
  r67368 | georg.brandl | 2008-11-24 13:56:47 -0600 (Mon, 24 Nov 2008) | 2 lines

  #4404: make clear what "path" is.
........
  r67398 | benjamin.peterson | 2008-11-26 11:39:17 -0600 (Wed, 26 Nov 2008) | 1 line

  fix typo in sqlite3 docs
........
  r67423 | jesse.noller | 2008-11-28 12:59:35 -0600 (Fri, 28 Nov 2008) | 2 lines

  issue4238: bsd support for cpu_count
........
  r67424 | christian.heimes | 2008-11-28 13:33:33 -0600 (Fri, 28 Nov 2008) | 1 line

  Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5
........
  r67432 | benjamin.peterson | 2008-11-28 17:18:46 -0600 (Fri, 28 Nov 2008) | 1 line

  SVN format 9 is the same it seems
........
  r67440 | jeremy.hylton | 2008-11-28 17:42:59 -0600 (Fri, 28 Nov 2008) | 4 lines

  Move definition int sval into branch of ifdef where it is used.

  Otherwise, you get a warning about an undefined variable.
........
  r67441 | jeremy.hylton | 2008-11-28 18:09:16 -0600 (Fri, 28 Nov 2008) | 2 lines

  Reflow long lines.
........
  r67444 | amaury.forgeotdarc | 2008-11-28 20:03:32 -0600 (Fri, 28 Nov 2008) | 2 lines

  Fix a small typo in docstring
........
  r67445 | benjamin.peterson | 2008-11-29 21:07:33 -0600 (Sat, 29 Nov 2008) | 1 line

  StringIO.close() stops you from using the buffer, too
........
  r67454 | benjamin.peterson | 2008-11-30 08:43:23 -0600 (Sun, 30 Nov 2008) | 1 line

  note the version that works
........
  r67455 | martin.v.loewis | 2008-11-30 13:28:27 -0600 (Sun, 30 Nov 2008) | 1 line

  Issue #4365: Add crtassem.h constants to the msvcrt module.
........
  r67457 | christian.heimes | 2008-11-30 15:16:28 -0600 (Sun, 30 Nov 2008) | 1 line

  w# requires Py_ssize_t
........
  r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line

  fix pyspecific extensions that were broken by Sphinx's grand renaming
........
2008-11-30 22:46:23 +00:00
Barry Warsaw 91cc8fb92b Fix for bug 4360 "SystemError when method has both super() & closure". Patch
by amaury.forgeotdarc and reviewed by brett.cannon.

Also add release notes about the known problems with the email package.
2008-11-20 20:01:57 +00:00
Benjamin Peterson 0f3641ce88 Merged revisions 67291 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67291 | benjamin.peterson | 2008-11-19 15:49:09 -0600 (Wed, 19 Nov 2008) | 5 lines

  make sure that bytearray methods return a new bytearray even if there is no change

  Fixes #4348
  Reviewed by Brett
........
2008-11-19 22:05:52 +00:00