Commit graph

3207 commits

Author SHA1 Message Date
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
Mark Dickinson
aa2adc828a Issue #6713: Improve performance of str(n) and repr(n) for integers n
(up to 3.1 times faster in tests), by special-casing base 10 in
_PyLong_Format.  (Backport of r74851 from py3k.)
2009-09-16 22:10:56 +00:00
Georg Brandl
0674d3fb5f #6844: do not emit DeprecationWarnings on access if Exception.message has been set by the user.
This works by always setting it in __dict__, except when it's implicitly set in __init__.
2009-09-16 20:30:09 +00:00
Mark Dickinson
1f4fc097f6 Fix potential signed-overflow bug in _PyLong_Format; also fix
a couple of whitespace issues.
2009-09-13 11:56:13 +00:00
Mark Dickinson
752a2daf32 Remove redundant assignment 2009-09-06 20:51:37 +00:00
Mark Dickinson
135a7cf540 Issue #6847: s/bytes/bytearray/ in some bytearray error messages. Thanks Hagen Fürstenau. 2009-09-06 10:32:21 +00:00
Mark Dickinson
c8a7c7c3b9 Issue #6846: bytearray.pop was returning ints in the range [-128, 128)
instead of [0, 256).  Thanks Hagen Fürstenau for the report and fix.
2009-09-06 10:03:31 +00:00
Benjamin Peterson
6fcf9b50bc remove the check that classmethod's argument is a callable 2009-09-01 22:27:57 +00:00
Mark Dickinson
2fdd58ad18 Silence gcc 'comparison always false' warning 2009-08-28 20:46:24 +00:00
Benjamin Peterson
4c6e8088f5 #6707 fix a crash with dir() on an uninitialized module 2009-08-15 13:16:38 +00:00
Eric Smith
5c4a5d2911 Issue 6330: Fix --enable-unicode=ucs4. 2009-07-30 13:39:44 +00:00
Raymond Hettinger
c2b9e1a134 Issue 6573: Fix set.union() for cases where self is in the argument chain. 2009-07-27 20:32:04 +00:00
Eric Smith
e94a826304 Sync trunk and py3k versions of string formatting. Will manually merge into py3k. 2009-07-27 01:58:25 +00:00
Benjamin Peterson
9119fbc683 clarify 2009-07-25 02:03:48 +00:00
Georg Brandl
ec812caf5d Issue #6540: Fixed crash for bytearray.translate() with invalid parameters. 2009-07-22 11:57:15 +00:00
Benjamin Peterson
24d9175ebe must use _PyThreadState_Current so it isn't checked for NULL #6530 2009-07-21 14:08:40 +00:00
Alexandre Vassalotti
fd00916c2e Grow the allocated buffer in PyUnicode_EncodeUTF7 to avoid buffer overrun.
Without this change, test_unicode.UnicodeTest.test_codecs_utf7 crashes in
debug mode. What happens is the unicode string u'\U000abcde' with a length
of 1 encodes to the string '+2m/c3g-' of length 8. Since only 5 bytes is
reserved in the buffer, a buffer overrun occurs.
2009-07-07 02:17:30 +00:00
Benjamin Peterson
1bf4765369 only order comparisons are removed in py3k #6119 2009-07-02 17:06:17 +00:00
Hirokazu Yamamoto
5c3dd9a1ee Issue #6368: Fixed unused variable warning on Unix. 2009-06-29 15:52:21 +00:00
Hirokazu Yamamoto
a3c5609079 Issue #4856: Remove checks for win NT. 2009-06-28 10:23:00 +00:00
Amaury Forgeot d'Arc
595f7a5bf9 #2016 Fix a crash in function call when the **kwargs dictionary is mutated
during the function call setup.

This even gives a slight speedup, probably because tuple allocation
is faster than PyMem_NEW.
2009-06-25 22:29:29 +00:00
Raymond Hettinger
62641e9534 Issue 6329: Fix iteration for memoryviews. 2009-06-23 20:59:43 +00:00