Commit Graph

328 Commits

Author SHA1 Message Date
Éric Araujo be3bd57ba2 Remove traces of division_warning left over from Python 2 (#10998) 2011-03-26 01:55:15 +01:00
Martin v. Löwis 4d0d471a80 Merge branches/pep-0384. 2010-12-03 20:14:31 +00:00
Georg Brandl e5b99f0fb3 Remove redundant includes of headers that are already included by Python.h. 2010-11-30 09:41:01 +00:00
Benjamin Peterson 8035bc5c04 follow up to #9778: define and use an unsigned hash type 2010-10-23 16:20:50 +00:00
Benjamin Peterson 8f67d0893f make hashes always the size of pointers; introduce Py_hash_t #9778 2010-10-17 20:54:53 +00:00
Victor Stinner f3170ccef8 Use locale encoding if Py_FileSystemDefaultEncoding is not set
* PyUnicode_EncodeFSDefault(), PyUnicode_DecodeFSDefaultAndSize() and
   PyUnicode_DecodeFSDefault() use the locale encoding instead of UTF-8 if
   Py_FileSystemDefaultEncoding is NULL
 * redecode_filenames() functions and _Py_code_object_list (issue #9630)
   are no more needed: remove them
2010-10-15 12:04:23 +00:00
Victor Stinner c39211f51e Issue #9630: Redecode filenames when setting the filesystem encoding
Redecode the filenames of:

 - all modules: __file__ and __path__ attributes
 - all code objects: co_filename attribute
 - sys.path
 - sys.meta_path
 - sys.executable
 - sys.path_importer_cache (keys)

Keep weak references to all code objects until initfsencoding() is called, to
be able to redecode co_filename attribute of all code objects.
2010-09-29 16:35:47 +00:00
Benjamin Peterson 41ece39c21 fix formatting 2010-09-11 16:39:57 +00:00
Antoine Pitrou 1a9a9d5433 Issue #1868: Eliminate subtle timing issues in thread-local objects by
getting rid of the cached copy of thread-local attribute dictionary.
2010-08-28 18:17:03 +00:00
Antoine Pitrou c47bd4a09a Issue #9294: remove dead code in Objects/object.c. Patch by Grant Limberg. 2010-07-27 22:08:27 +00:00
Mark Dickinson dc787d2055 Issue #8188: Introduce a new scheme for computing hashes of numbers
(instances of int, float, complex, decimal.Decimal and
fractions.Fraction) that makes it easy to maintain the invariant that
hash(x) == hash(y) whenever x and y have equal value.
2010-05-23 13:33:13 +00:00
Mark Dickinson fff532bef3 Issue #8749: remove unused code in Objects/object.c. Thanks Yaniv Aknin. 2010-05-22 12:02:35 +00:00
Victor Stinner ba6b430bd0 Fix refleak in internal_print() introduced by myself in r81251
_PyUnicode_AsDefaultEncodedString() uses a magical PyUnicode attribute to
automatically destroy PyUnicode_EncodeUTF8() result when the unicode string is
destroyed.
2010-05-17 09:33:42 +00:00
Victor Stinner 372ac5e732 PyObject_Dump() encodes unicode objects to utf8 with backslashreplace (instead
of strict) error handler to escape surrogates
2010-05-17 01:26:01 +00:00
Antoine Pitrou f95a1b3c53 Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines

  Untabify C files. Will watch buildbots.
........
2010-05-09 15:52:27 +00:00
Mark Dickinson 1472150cc2 Merged revisions 79809 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79809 | mark.dickinson | 2010-04-05 19:54:51 +0100 (Mon, 05 Apr 2010) | 1 line

  Use a better NaN test in _Py_HashDouble as well.
........
2010-04-06 10:29:17 +00:00
Mark Dickinson 5daab45158 Merged revisions 79804 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79804 | mark.dickinson | 2010-04-05 19:07:51 +0100 (Mon, 05 Apr 2010) | 5 lines

  Use a more robust infinity check in _Py_HashDouble.

  This fixes a test_decimal failure on FreeBSD 8.0.  (modf apparently
  doesn't follow C99 Annex F on FreeBSD.)
........
2010-04-05 18:09:39 +00:00
Victor Stinner 624dbf6220 Issue #6697: catch _PyUnicode_AsString() errors in getattr() and setattr()
builtin functions.
2010-03-12 17:17:58 +00:00
Mark Dickinson 6711493e40 Issue #7430: Remove lingering reference to cmp in recursion error message. 2009-12-04 10:06:06 +00:00
Mark Dickinson 6f1d04945b Issue #6970: Remove redundant calls made when comparing objects. 2009-11-15 13:58:49 +00:00
Skip Montanaro ba1e0f46ab Issue 7147 - remove ability to attempt to build Python without complex number support (was broken anyway) 2009-10-18 14:25:35 +00:00
Benjamin Peterson 1432771d55 Merged revisions 74457 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74457 | benjamin.peterson | 2009-08-15 08:16:38 -0500 (Sat, 15 Aug 2009) | 1 line

  #6707 fix a crash with dir() on an uninitialized module
........
2009-08-15 13:23:05 +00:00
Benjamin Peterson 6e5b0a1140 remove reference to PyCObject 2009-07-01 01:31:12 +00:00
Benjamin Peterson 94c65d9a8f Merged revisions 72907 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72907 | benjamin.peterson | 2009-05-24 21:40:21 -0500 (Sun, 24 May 2009) | 1 line

  handle errors from _PyObject_LookupSpecial when __get__ fails
........
2009-05-25 03:10:48 +00:00
Benjamin Peterson 8bc5b68159 these builtins have to be initialized 2009-05-09 18:10:51 +00:00
Benjamin Peterson da136967e9 this is now a bound method 2009-05-08 03:27:59 +00:00
Benjamin Peterson 224205fde2 Merged revisions 72461 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72461 | benjamin.peterson | 2009-05-07 22:06:00 -0500 (Thu, 07 May 2009) | 1 line

  add _PyObject_LookupSpecial to handle fetching special method lookup
........
2009-05-08 03:25:19 +00:00
Benjamin Peterson b173f7853e add a replacement API for PyCObject, PyCapsule #5630
All stdlib modules with C-APIs now use this.

Patch by Larry Hastings
2009-05-05 22:31:58 +00:00
Benjamin Peterson fd838e6c84 Merged revisions 71734,71738-71739 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71734 | benjamin.peterson | 2009-04-18 17:15:26 -0500 (Sat, 18 Apr 2009) | 1 line

  many more types to initialize (I had to expose some of them)
........
  r71738 | benjamin.peterson | 2009-04-18 21:32:42 -0500 (Sat, 18 Apr 2009) | 1 line

  initialize weakref some weakref types
........
  r71739 | benjamin.peterson | 2009-04-18 21:40:43 -0500 (Sat, 18 Apr 2009) | 1 line

  make errors consistent
........
2009-04-20 02:09:13 +00:00
Benjamin Peterson ae937c021d Merged revisions 71722 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71722 | benjamin.peterson | 2009-04-18 15:12:47 -0500 (Sat, 18 Apr 2009) | 1 line

  try to initalize all builtin types with PyType_Ready to avoid problems like #5787
........
2009-04-18 20:54:08 +00:00
Georg Brandl dfd734429e Merge revision 71222 from trunk: #5615: make it possible to configure --without-threads again. 2009-04-05 11:47:34 +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
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
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
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 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
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
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
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
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
Mark Dickinson 4a1f593df5 Issue #4296: Fix PyObject_RichCompareBool so that "x in [x]" evaluates to
True, even when x doesn't compare equal to itself.  This was a regression
from 2.6.

Reviewed by R. Hettinger and C. Heimes.
2008-11-12 23:23:36 +00:00
Christian Heimes ff869fa0f0 Removed bytesmeth declaration in OyObject_Bytes. It's not used any more and causes a compiler warning. 2008-08-28 11:28:26 +00:00
Benjamin Peterson c15a07333e make bytes(o) respect __bytes__ #2415
This adds two new C-API functions: PyObject_Bytes and PyBytes_FromObject.

Reviewer: Barry
2008-08-26 16:46:47 +00:00
Marc-André Lemburg 4cc0f24857 Rename PyUnicode_AsString -> _PyUnicode_AsString and
PyUnicode_AsStringAndSize -> _PyUnicode_AsStringAndSize to mark
them for interpreter internal use only.

We'll have to rework these APIs or create new ones for the
purpose of accessing the UTF-8 representation of Unicode objects
for 3.1.
2008-08-07 18:54:33 +00:00
Nick Coghlan d1abd25ed8 Manual forward port of 64962 - use PyObject_HashNotImplemented as a tp_hash level indicator that the default hash implementation has not been inherited 2008-07-15 15:46:38 +00:00
Georg Brandl 559e5d7f4d #2630: Implement PEP 3138.
The repr() of a string now contains printable Unicode characters unescaped.
The new ascii() builtin can be used to get a repr() with only ASCII characters in it.

PEP and patch were written by Atsuo Ishimoto.
2008-06-11 18:37:52 +00:00
Christian Heimes 72b710a596 Renamed PyString to PyBytes 2008-05-26 13:28:38 +00:00
Christian Heimes 9c4756ea26 Renamed PyBytes to PyByteArray 2008-05-26 13:22:05 +00:00
Christian Heimes 969fe57baa Merged revisions 60245-60277 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r60246 | guido.van.rossum | 2008-01-24 18:58:05 +0100 (Thu, 24 Jan 2008) | 2 lines

  Fix test67.py from issue #1303614.
........
  r60248 | raymond.hettinger | 2008-01-24 19:05:54 +0100 (Thu, 24 Jan 2008) | 1 line

  Clean-up and speed-up code by accessing numerator/denominator directly.  There's no reason to enforce readonliness
........
  r60249 | raymond.hettinger | 2008-01-24 19:12:23 +0100 (Thu, 24 Jan 2008) | 1 line

  Revert 60189 and restore performance.
........
  r60250 | guido.van.rossum | 2008-01-24 19:21:02 +0100 (Thu, 24 Jan 2008) | 5 lines

  News about recently fixed crashers:
  - A few crashers fixed: weakref_in_del.py (issue #1377858);
    loosing_dict_ref.py (issue #1303614, test67.py);
    borrowed_ref_[34].py (not in tracker).
........
  r60252 | thomas.heller | 2008-01-24 19:36:27 +0100 (Thu, 24 Jan 2008) | 7 lines

  Use a PyDictObject again for the array type cache; retrieving items
  from the WeakValueDictionary was slower by nearly a factor of 3.

  To avoid leaks, weakref proxies for the array types are put into the
  cache dict, with weakref callbacks that removes the entries when the
  type goes away.
........
  r60253 | thomas.heller | 2008-01-24 19:54:12 +0100 (Thu, 24 Jan 2008) | 2 lines

  Replace Py_BuildValue with PyTuple_Pack because it is faster.
  Also add a missing DECREF.
........
  r60254 | raymond.hettinger | 2008-01-24 20:05:29 +0100 (Thu, 24 Jan 2008) | 1 line

  Add support for trunc().
........
  r60255 | thomas.heller | 2008-01-24 20:15:02 +0100 (Thu, 24 Jan 2008) | 5 lines

  Invert the checks in get_[u]long and get_[u]longlong.  The intent was
  to not accept float types; the result was that integer-like objects
  were not accepted.

  Ported from release25-maint.
........
  r60256 | raymond.hettinger | 2008-01-24 20:30:19 +0100 (Thu, 24 Jan 2008) | 1 line

  Add support for int(r) just like the other numeric classes.
........
  r60263 | raymond.hettinger | 2008-01-24 22:23:58 +0100 (Thu, 24 Jan 2008) | 1 line

  Expand tests to include nested graph structures.
........
  r60264 | raymond.hettinger | 2008-01-24 22:47:56 +0100 (Thu, 24 Jan 2008) | 1 line

  Shorter pprint's for empty sets and frozensets.  Fix indentation of frozensets.  Add tests including two complex data structures.
........
  r60265 | amaury.forgeotdarc | 2008-01-24 23:51:18 +0100 (Thu, 24 Jan 2008) | 14 lines

  #1920: when considering a block starting by "while 0", the compiler optimized the
  whole construct away, even when an 'else' clause is present::

      while 0:
          print("no")
      else:
          print("yes")

  did not generate any code at all.

  Now the compiler emits the 'else' block, like it already does for 'if' statements.

  Will backport.
........
  r60266 | amaury.forgeotdarc | 2008-01-24 23:59:25 +0100 (Thu, 24 Jan 2008) | 2 lines

  News entry for r60265 (Issue 1920).
........
  r60269 | raymond.hettinger | 2008-01-25 00:50:26 +0100 (Fri, 25 Jan 2008) | 1 line

  More code cleanup.  Remove unnecessary indirection to useless class methods.
........
  r60270 | raymond.hettinger | 2008-01-25 01:21:54 +0100 (Fri, 25 Jan 2008) | 1 line

  Add support for copy, deepcopy, and pickle.
........
  r60271 | raymond.hettinger | 2008-01-25 01:33:45 +0100 (Fri, 25 Jan 2008) | 1 line

  Mark todos and review comments.
........
  r60272 | raymond.hettinger | 2008-01-25 02:13:12 +0100 (Fri, 25 Jan 2008) | 1 line

  Add one other review comment.
........
  r60273 | raymond.hettinger | 2008-01-25 02:23:38 +0100 (Fri, 25 Jan 2008) | 1 line

  Fix-up signature for approximation.
........
  r60274 | raymond.hettinger | 2008-01-25 02:46:33 +0100 (Fri, 25 Jan 2008) | 1 line

  More design notes
........
  r60276 | neal.norwitz | 2008-01-25 07:37:23 +0100 (Fri, 25 Jan 2008) | 6 lines

  Make the test more robust by trying to reconnect up to 3 times
  in case there were transient failures.  This will hopefully silence
  the buildbots for this test.  As we find other tests that have a problem,
  we can fix with a similar strategy assuming it is successful.  It worked
  on my box in a loop for 10+ runs where it would have an exception otherwise.
........
  r60277 | neal.norwitz | 2008-01-25 09:04:16 +0100 (Fri, 25 Jan 2008) | 4 lines

  Add prototypes to get the mathmodule.c to compile on OSF1 5.1 (Tru64)
  and eliminate a compiler warning in floatobject.c.  There might be
  a better way to go about this, but it should be good enough for now.
........
2008-01-25 11:23:10 +00:00