Commit Graph

3228 Commits

Author SHA1 Message Date
Mark Dickinson 4657283647 Issue #1811: Improve accuracy and consistency of true division for integers. 2009-12-27 14:55:57 +00:00
Ezio Melotti f84caf4eda #6108: unicode(exception) and str(exception) should return the same message 2009-12-24 22:25:17 +00:00
Mark Dickinson e31d300664 Issue #7528: Backport PyLong_AsLongAndOverflow from py3k to trunk.
Thanks Case Van Horsen for the patch.
2009-12-21 11:21:25 +00:00
Benjamin Peterson 0c0dcaf272 remove type_compare, since type_richcompare does the same trick 2009-12-16 03:36:22 +00:00
R. David Murray 0a0a1a842c Issue #1680159: unicode coercion during an 'in' operation was masking
any errors that might occur during coercion of the left operand and
turning them into a TypeError with a message text that was confusing in
the given context.  This patch lets any errors through, as was already
done during coercion of the right hand side.
2009-12-14 16:28:26 +00:00
Benjamin Peterson 4895af4ef1 fix the ignoring of __cmp__ method on metaclasses #7491 2009-12-13 16:36:53 +00:00
Antoine Pitrou c169c781a8 Issue #7466: segmentation fault when the garbage collector is called
in the middle of populating a tuple.  Patch by Florent Xicluna.

(note: no NEWS entry for trunk since the bug was introduced in 2.7/3.1)
2009-12-12 19:13:08 +00:00
Benjamin Peterson 5fb877027b substitute PyDict_Check() for PyObject_IsInstance 2009-12-10 03:37:59 +00:00
Mark Dickinson 1691025ff2 Avoid undefined behaviour due to overflow in i_divmod (Objects/intobject.c). 2009-12-04 11:24:38 +00:00
Benjamin Peterson 91c12ebc3d disable pymalloc tricks with the --with-valgrind option #2422
Patch from James Henstridge.
2009-12-03 02:52:39 +00:00
Mark Dickinson 34398184eb Issue #7406: Fix some occurrences of potential signed overflow in int
arithmetic.
2009-12-02 17:33:41 +00:00
Eric Smith c4ab8339e9 Issue #3382: Make '%F' and float.__format__('F') convert results to upper case. Much of the patch came from Mark Dickinson. 2009-11-29 17:40:57 +00:00
Mark Dickinson 31f0cfef0e Include ieeefp.h (when available) in pyport.h instead of individually in
Objects/floatobject.c and Objects/complexobject.c.  This should silence
compiler warnings about implicit declaration of the 'finite' function
on Solaris.
2009-11-28 12:30:36 +00:00
Mark Dickinson 9dd5e16c5d Issue #7117, continued: Remove substitution of %g-style formatting for
%f-style formatting, which used to occur at high precision.  Float formatting
should now be consistent between 2.7 and 3.1.
2009-11-23 20:54:09 +00:00
Mark Dickinson 18cfada1ea Remove restriction on precision when formatting floats. This is the
first step towards removing the %f -> %g switch (see issues 7117,
5859).
2009-11-23 18:46:41 +00:00
Benjamin Peterson dc3c239b1e #5037 proxy __unicode__ correctly 2009-11-19 03:00:02 +00:00
Raymond Hettinger 79628d311f Issue 7263: Fix set.intersection() docstring. 2009-11-18 20:28:22 +00:00
Mark Dickinson bd15a06fd3 Issue #7117, continued: Change round implementation to use the correctly-rounded
string <-> float conversions;  this makes sure that the result of the round
operation is correctly rounded, and hence displays nicely using the new float
repr.
2009-11-18 19:33:35 +00:00
Mark Dickinson 3d6790e49f Silence another MSVC warning about unary minus. 2009-11-16 19:17:16 +00:00
Mark Dickinson b2c3ca1e38 Silence MSVC warning about unary minus applied to unsigned type. 2009-11-16 17:33:25 +00:00
Mark Dickinson 82864d1ab1 Issue #7228: Add '%lld' and '%llu' support to PyFormat_FromString,
PyFormat_FromStringV and PyErr_Format.
2009-11-15 16:18:58 +00:00
Mark Dickinson 009ae861f2 Avoid signed overflow in some xrange calculations, and extend
xrange tests to cover some special cases that caused problems
in py3k.  This is a partial backport of r76292-76293 (see
issue #7298.)
2009-11-15 12:31:13 +00:00
Benjamin Peterson c45a0cfb5f grant list.index() a more informative error message #7252 2009-11-02 16:14:19 +00:00
Benjamin Peterson e2caf1f60e prevent a rather unlikely segfault 2009-11-02 15:06:45 +00:00
Mark Dickinson c04c7c5b72 Issue #7117: Use PyOS_string_to_double instead of PyOS_ascii_strtod in
complexobject.c.  Also remove length restriction on unicode inputs to
the complex constructor.
2009-10-26 22:28:14 +00:00
Mark Dickinson 8568b19850 Issue #7117: Use PyOS_string_to_double instead of PyOS_ascii_strtod in
floatobject.c.  Also, remove limitation on length of unicode inputs to
float().
2009-10-26 21:11:20 +00:00
Eric Smith c1bdf89145 Finished removing _PyOS_double_to_string, as mentioned in issue 7117. 2009-10-26 17:46:17 +00:00
Eric Smith cfaf79c56e Start to remove _PyOS_double_to_string, as mentioned in issue 7117. 2009-10-26 14:48:55 +00:00
Mark Dickinson 8d87dc0c29 Issue #1087418: Small performance boost for bitwise operations on longs.
Initial patch by Gregory Smith;  some tweaks added.
2009-10-25 20:39:06 +00:00
Eric Smith 8c3fb39440 Removed unused function PyFloat_AsStringEx. It is unused in floatobject.c, and it's not declared in any .h file. 2009-10-24 19:50:44 +00:00
Benjamin Peterson 97a57ec048 rewrite for style, clarify, and comments
Also, use the hasattr() like scheme of allowing BaseException exceptions through.
2009-10-22 02:50:38 +00:00
Benjamin Peterson 3c67afa714 whitespace 2009-10-22 02:26:47 +00:00
Eric Smith b327258d4f Removed usage of unsafe PyFloat_AsString. 2009-10-16 14:26:36 +00:00
Mark Dickinson 08133af12e Issue #7142: Fix uses of unicode in memoryview objects 2009-10-15 15:53:58 +00:00
Benjamin Peterson 196b0925ca only clear a module's __dict__ if the module is the only one with a reference to it #7140 2009-10-15 15:44:46 +00:00
Mark Dickinson 9d109742c0 Fix missing semicolon 2009-10-15 15:18:55 +00:00
Georg Brandl 9b4e5820cb #7116: str.join() takes an iterable. 2009-10-14 18:48:32 +00:00
Amaury Forgeot d'Arc 5c92d4301d #7112: Fix compilation warning in unicodetype_db.h
makeunicodedata now generates double literals
2009-10-13 21:29:34 +00:00
Antoine Pitrou beaf6a02f4 Issue #7084: Fix a (very unlikely) crash when printing a list from one
thread, and mutating it from another one.  Patch by Scott Dial.
2009-10-11 21:03:26 +00:00
Amaury Forgeot d'Arc d0052d17b1 #1571184: makeunicodedata.py now generates the functions _PyUnicode_ToNumeric,
_PyUnicode_IsLinebreak and _PyUnicode_IsWhitespace.

It now also parses the Unihan.txt for numeric values.
2009-10-06 19:56:32 +00:00
Mark Dickinson 71adc9328d Style/consistency/nano-optimization nit: replace occurrences of
(high_bits << PyLong_SHIFT) + low_bits with
  (high_bits << PyLong_SHIFT) | low_bits
in Objects/longobject.c.  Motivation:
 - shouldn't unnecessarily mix bit ops with arithmetic ops (style)
 - this pattern should be spelt the same way thoughout (consistency)
 - it's very very very slightly faster: no need to worry about
   carries to the high digit (nano-optimization).
2009-09-28 16:52:40 +00:00
Kristján Valur Jónsson b331802f97 http://bugs.python.org/issue6836
A missing 'const' wasn't detected by Visual Studio.
2009-09-28 15:56:25 +00:00
Kristján Valur Jónsson 02ca57ce4c http://bugs.python.org/issue6836
The debug memory api now keeps track of which external API (PyMem_* or PyObject_*) was used to allocate each block and treats any API violation as an error.  Added separate _PyMem_DebugMalloc functions for the Py_Mem API instead of having it use the _PyObject_DebugMalloc functions.
2009-09-28 13:12:38 +00:00
Mark Dickinson 4b9d473d0a Issue #6713: Improve decimal int -> string conversions. Thanks Gawain
Bolton for the suggestion and original patches.
2009-09-27 16:05:21 +00:00
Ezio Melotti a9a7611fb6 #6994: fix typo in enumerate docstring 2009-09-25 16:07:55 +00:00
Mark Dickinson 40ee861c0a Silence MSVC compiler warnings. 2009-09-21 16:16:44 +00:00
Benjamin Peterson dc782b55f2 backport keyword argument support for bytearray.decode 2009-09-18 21:46:21 +00:00
Benjamin Peterson 332d721750 add keyword arguments support to str/unicode encode and decode #6300 2009-09-18 21:14:55 +00:00
Benjamin Peterson 4fe03350b5 use macros 2009-09-17 21:33:46 +00:00
Georg Brandl e9741f3ed8 Issue #6922: Fix an infinite loop when trying to decode an invalid
UTF-32 stream with a non-raising error handler like "replace" or "ignore".
2009-09-17 11:28:09 +00:00