Commit graph

4771 commits

Author SHA1 Message Date
Antoine Pitrou
dc040f099d Fix supernumerary 's' in sys._debugmallocstats() output. 2013-04-11 21:02:20 +02:00
Antoine Pitrou
36b045f4db Fix supernumerary 's' in sys._debugmallocstats() output. 2013-04-11 21:01:40 +02:00
Benjamin Peterson
34ad84d80a merge 3.3 (#17669) 2013-04-10 17:01:38 -04:00
Benjamin Peterson
c9314d9e08 don't run frame if it has no stack (closes #17669) 2013-04-10 17:00:56 -04:00
Victor Stinner
247109e74d Issue #17615: On Windows (VS2010), Performances of wmemcmp() to compare Unicode
strings are not convincing. For UCS2 (16-bit wchar_t type), use a dummy loop
instead of wmemcmp(). The dummy loop is as fast, or a little bit faster.

wchar_t is only 16-bit long on Windows. wmemcmp() is still used for 32-bit
wchar_t.
2013-04-09 23:53:26 +02:00
Victor Stinner
0cff4b16d9 replace(): only call PyUnicode_DATA(u) once 2013-04-09 22:52:48 +02:00
Victor Stinner
cc7af72192 Write super-fast version of str.strip(), str.lstrip() and str.rstrip() for pure ASCII 2013-04-09 22:39:24 +02:00
Victor Stinner
f50a4e9bc9 Don't calls macros in PyUnicode_WRITE() parameters
PyUnicode_WRITE() expands some parameters twice or more.
2013-04-09 22:38:52 +02:00
Victor Stinner
9c79e41fc5 Fix do_strip(): don't call PyUnicode_READ() in Py_UNICODE_ISSPACE() to not call
it twice
2013-04-09 22:21:08 +02:00
Victor Stinner
b3a6014504 Fix _PyUnicode_XStrip()
Inline the BLOOM_MEMBER() to only call PyUnicode_READ() only once (per loop
iteration). Store also the length of the seperator in a variable to avoid calls
to PyUnicode_GET_LENGTH().
2013-04-09 22:19:21 +02:00
Victor Stinner
63d5c1a14a Optimize PyUnicode_DecodeCharmap()
Avoid expensive PyUnicode_READ() and PyUnicode_WRITE(), manipulate pointers
instead.
2013-04-09 22:13:33 +02:00
Victor Stinner
a85af502a4 Optimize make_bloom_mask(), used by str.strip(), str.lstrip() and str.rstrip()
Write specialized functions per Unicode kind to avoid the expensive
PyUnicode_READ() macro.
2013-04-09 21:53:54 +02:00
Victor Stinner
69ed0f4c86 Use PyUnicode_READ() instead of PyUnicode_READ_CHAR()
"PyUnicode_READ_CHAR() is less efficient than PyUnicode_READ() because it calls
PyUnicode_KIND() and might call it twice." according to its documentation.
2013-04-09 21:48:24 +02:00
Victor Stinner
03c3e35d42 Add fast-path in PyUnicode_DecodeCharmap() for pure 8 bit encodings:
cp037, cp500 and iso8859_1 codecs
2013-04-09 21:53:09 +02:00
Victor Stinner
cd777eaf53 Issue #17615: Comparing two Unicode strings now uses wmemcmp() when possible
wmemcmp() is twice faster than a dummy loop (342 usec vs 744 usec) on Fedora
18/x86_64, GCC 4.7.2.
2013-04-08 22:43:44 +02:00
Victor Stinner
c1302bba4c Issue #17615: Expand expensive PyUnicode_READ() macro in unicode_compare():
write specialized functions for each combination of Unicode kinds.
2013-04-08 21:50:54 +02:00
Victor Stinner
7efa3b8242 Close #13126: "Simplify" FASTSEARCH() code to help the compiler to emit more
efficient machine code. Patch written by Antoine Pitrou.

Without this change, str.find() was 10% slower than str.rfind() in the worst
case.
2013-04-08 00:26:43 +02:00
Serhiy Storchaka
ee57f159af Revert a premature patch for issue #14010 (changeset 846bd418aee5). 2013-04-06 22:55:12 +03:00
Serhiy Storchaka
278d03bd66 Revert a premature patch for issue #14010 (changeset aaaf36026511). 2013-04-06 22:52:34 +03:00
Serhiy Storchaka
aac81e2780 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:20:30 +03:00
Serhiy Storchaka
e8f706eda7 Issue #14010: Fix a crash when iterating or deleting deeply nested filters
(builting and in itertools module, i.e. map(), itertools.chain(), etc).
2013-04-06 21:14:43 +03:00
Antoine Pitrou
0aaaa62200 Issue #17469: Fix _Py_GetAllocatedBlocks() and sys.getallocatedblocks() when running on valgrind. 2013-04-06 01:15:30 +02:00
Victor Stinner
207dd38726 fix unused variable 2013-04-03 03:14:58 +02:00
Victor Stinner
eb4b5ac8af Close #16757: Avoid calling the expensive _PyUnicode_FindMaxChar() function
when possible
2013-04-03 02:02:33 +02:00
Victor Stinner
cfc4c13b04 Add _PyUnicodeWriter_WriteSubstring() function
Write a function to enable more optimizations:

 * If the substring is the whole string and overallocation is disabled, just
   keep a reference to the string, don't copy characters
 * Avoid a call to the expensive _PyUnicode_FindMaxChar() function when
   possible
2013-04-03 01:48:39 +02:00
Benjamin Peterson
d3f41fe121 merge 3.3 (#17610) 2013-04-01 17:43:30 -04:00
Benjamin Peterson
6395241471 list slotdefs in offset order rather than sorting them (closes #17610)
This means we can remove our usage of qsort() than relied on undefined behavior.
2013-04-01 17:41:41 -04:00
Antoine Pitrou
7faf70512a Issue #17591: Use lowercase filenames when including Windows header files.
Patch by Roumen Petrov.
2013-03-31 22:48:04 +02:00
Raymond Hettinger
51612fd803 merge 2013-03-23 08:21:52 -07:00
Raymond Hettinger
378170d5d9 Issue 17447: Clarify that str.isidentifier doesn't check for reserved keywords. 2013-03-23 08:21:12 -07:00
Benjamin Peterson
5589850c14 fix warning (closes #17327) 2013-03-08 08:36:49 -05:00
Benjamin Peterson
00e9886bd9 Add PyDict_SetDefault. (closes #17327)
Patch by Stefan Behnel and I.
2013-03-07 22:16:29 -05:00
Victor Stinner
fb84b5d48d (Merge 3.3) _PyUnicode_Writer() now also reuses Unicode singletons:
empty string and latin1 single character
2013-03-06 19:29:09 +01:00
Victor Stinner
2cb16aa3cb _PyUnicode_Writer() now also reuses Unicode singletons:
empty string and latin1 single character
2013-03-06 19:28:37 +01:00
Victor Stinner
cf77da9fb5 Backed out changeset b9f7b1bf36aa 2013-03-06 01:09:24 +01:00
Victor Stinner
313cac88c5 Issue #17223: Fix PyUnicode_FromUnicode() on Windows (16-bit wchar_t type)
to reject invalid UTF-16 surrogate.
2013-03-06 00:41:50 +01:00
Benjamin Peterson
42f382facd merge 3.3 (#17328) 2013-03-04 09:48:30 -05:00
Benjamin Peterson
b1efa53662 fix possible setdefault refleak (closes #17328) 2013-03-04 09:47:50 -05:00
Victor Stinner
36025478bf (Merge 3.3) Issue #17223: Fix PyUnicode_FromUnicode() for string of 1 character
outside the range U+0000-U+10ffff.
2013-02-26 00:16:57 +01:00
Victor Stinner
d21b58c05d Issue #17223: Fix PyUnicode_FromUnicode() for string of 1 character outside
the range U+0000-U+10ffff.
2013-02-26 00:15:54 +01:00
Serhiy Storchaka
06b16f879f Remove unused defines. 2013-02-23 14:49:09 +02:00
Serhiy Storchaka
18809fa94e Remove unused defines. 2013-02-23 14:48:16 +02:00
Benjamin Peterson
abe40c2528 merge 3.3 (#17228) 2013-02-20 16:56:06 -05:00
Benjamin Peterson
2dba1ee3e6 fix building without pymalloc (closes #17228) 2013-02-20 16:54:30 -05:00
Stefan Krah
5e06d1d0b9 Merge 3.3. 2013-02-19 14:02:59 +01:00
Stefan Krah
674a42b114 Fix error messages. 2013-02-19 13:44:49 +01:00
R David Murray
aaf16b9cfb Merge: #7963: fix error message when 'object' called with arguments. 2013-02-18 21:44:03 -05:00
R David Murray
702a5dc1ed #7963: fix error message when 'object' called with arguments. 2013-02-18 21:39:18 -05:00
R David Murray
6b30759022 #7963: fix error message when 'object' called with arguments.
Patch by Alexander Belopolsky.
2013-02-18 21:20:08 -05:00
Eric Snow
9d05c8c0e0 Issue #15022: Ensure all pickle protocols are supported. 2013-02-16 18:20:32 -07:00