Commit Graph

4614 Commits

Author SHA1 Message Date
Serhiy Storchaka 1cfebc73e0 Issue #9369: The types of `char*` arguments of PyObject_CallFunction() and
PyObject_CallMethod() now changed to `const char*`.
Based on patches by Jörg Müller and Lars Buitinck.
2013-05-29 18:50:54 +03:00
Benjamin Peterson 4d94474ba3 rewrite the parsing of field names to be more consistent wrt recursive expansion 2013-05-17 18:22:31 -05:00
Benjamin Peterson 48953632df merge 3.3 2013-05-17 17:35:28 -05:00
Benjamin Peterson d2b58a9880 only recursively expand in the format spec (closes #17644) 2013-05-17 17:34:30 -05:00
Raymond Hettinger 2f6fe51860 merge 2013-05-17 03:24:54 -07:00
Raymond Hettinger 36f74aa7f7 Issue #17563: Fix dict resize performance regression. 2013-05-17 03:01:13 -07:00
Benjamin Peterson e1b4cbc422 when arguments are cells clear the locals slot (backport of #17927) 2013-05-14 22:31:26 -05:00
Antoine Pitrou 9396356948 Backout c89febab4648 following private feedback by Guido.
(Issue #17807: Generators can now be finalized even when they are part of a reference cycle)
2013-05-14 20:37:52 +02:00
Benjamin Peterson 159ae41da6 when an argument is a cell, set the local copy to NULL (see #17927) 2013-05-12 18:16:06 -05:00
Brett Cannon f27541653b Touch up grammar for dict.update() docstring. 2013-05-11 14:46:48 -04:00
Antoine Pitrou 7ce35a1816 Issue #17237: Fix crash in the ASCII decoder on m68k. 2013-05-11 15:59:37 +02:00
Antoine Pitrou 8b0e98426d Issue #17237: Fix crash in the ASCII decoder on m68k. 2013-05-11 15:58:34 +02:00
Guido van Rossum 6832c81d5d #17927: Keep frame from referencing cell-ified arguments. 2013-05-10 08:47:42 -07:00
Antoine Pitrou 04e70d19e7 Issue #17807: Generators can now be finalized even when they are part of a reference cycle. 2013-05-08 18:12:35 +02:00
Victor Stinner 6f75a3e89e Use Py_intptr_t to store the difference between two pointers, instead of int
Fix a compiler warning on Windows 64-bit
2013-05-08 00:44:15 +02:00
Victor Stinner f4f24248dc Fix uninitialized value in charmap_decode_mapping() 2013-05-07 01:01:31 +02:00
Victor Stinner 8cecc8c262 Issue #7330: Implement width and precision (ex: "%5.3s") for the format string
of PyUnicode_FromFormat() function, original patch written by Ysj Ray.
2013-05-06 23:11:54 +02:00
Antoine Pitrou df6931dbbc Issue #17408: Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again. 2013-05-04 20:46:19 +02:00
Antoine Pitrou 957a23b088 Issue #17408: Avoid using an obsolete instance of the copyreg module when the interpreter is shutdown and then started again. 2013-05-04 20:45:02 +02:00
Brett Cannon 4c14b5de1c #17115,17116: Have modules initialize the __package__ and __loader__
attributes to None.

The long-term goal is for people to be able to rely on these
attributes existing and checking for None to see if they have been
set. Since import itself sets these attributes when a loader does not
the only instances when the attributes are None are from someone
overloading __import__() and not using a loader or someone creating a
module from scratch.

This patch also unifies module initialization. Before you could have
different attributes with default values depending on how the module
object was created. Now the only way to not get the same default set
of attributes is to circumvent initialization by calling
ModuleType.__new__() directly.
2013-05-04 13:56:58 -04:00
Alexandre Vassalotti 865eaa1b53 Closes #17892: Fix the name of _PyObject_CallMethodObjIdArgs 2013-05-02 10:44:04 -07:00
Ezio Melotti 5263c13801 Merge removal of trailing whitespace from 3.3. 2013-04-21 04:08:18 +03:00
Ezio Melotti 6b02772c13 Remove trailing whitespace. 2013-04-21 04:07:51 +03:00
Victor Stinner bb4503f61e Partial revert of changeset 9744b2df134c
PyUnicode_Append() cannot call directly resize_compact(): I forgot that a
string can be ready *and* not compact (a legacy string can also be ready).
2013-04-18 09:41:34 +02:00
Victor Stinner fb161b1b6d Split PyUnicode_DecodeCharmap() into subfunction for readability 2013-04-18 01:44:27 +02:00
Victor Stinner 170ca6f84b Fix bug in Unicode decoders related to _PyUnicodeWriter
Bug introduced by changesets 7ed9993d53b4 and edf029fc9591.
2013-04-18 00:25:28 +02:00
Victor Stinner 376cfa122d Fix typo in unicode_decode_call_errorhandler_writer()
Bug introduced by changeset 7ed9993d53b4.
2013-04-17 23:58:16 +02:00
Victor Stinner 8f674ccd64 Close #17694: Add minimum length to _PyUnicodeWriter
* Add also min_char attribute to _PyUnicodeWriter structure (currently unused)
 * _PyUnicodeWriter_Init() has no more argument (except the writer itself):
   min_length and overallocate must be set explicitly
 * In error handlers, only enable overallocation if the replacement string
   is longer than 1 character
 * CJK decoders don't use overallocation anymore
 * Set min_length, instead of preallocating memory using
   _PyUnicodeWriter_Prepare(), in many decoders
 * _PyUnicode_DecodeUnicodeInternal() checks for integer overflow
2013-04-17 23:02:17 +02:00
Victor Stinner 77282cb4f8 Cleanup PyUnicode_Contains()
* No need to double-check that strings are ready: test already done by
   PyUnicode_FromObject()
 * Remove useless kind variable (use kind1 instead)
2013-04-14 19:22:47 +02:00
Victor Stinner d92e078c8d Minor change: fix character in do_strip() for the ASCII case 2013-04-14 19:17:42 +02:00
Victor Stinner f033510fee Cleanup PyUnicode_Append()
* Check also that right is a Unicode object
 * call directly resize_compact() instead of unicode_resize() for a more
   explicit error handling, and to avoid testing some properties twice
   (ex: unicode_modifiable())
2013-04-14 19:13:03 +02:00
Victor Stinner 4560f9c63f PyUnicode_Join(): move use_memcpy test out of the loop to cleanup and optimize the code 2013-04-14 18:56:46 +02:00
Victor Stinner 55c08781e8 Optimize repr(str): use _PyUnicode_FastCopyCharacters() when no character is escaped 2013-04-14 18:45:39 +02:00
Victor Stinner af03757d20 Optimize ascii(str): don't encode/decode repr if repr is already ASCII 2013-04-14 18:44:10 +02:00
Victor Stinner 76b3b2726c stringlib: remove unused STRINGLIB_RESIZE macro 2013-04-14 16:29:09 +02:00
Victor Stinner 8a1a6cffd6 Add _PyUnicodeWriter_WriteCharInline() 2013-04-14 02:35:33 +02:00
Serhiy Storchaka e2cef885a2 Issue #16061: Speed up str.replace() for replacing 1-character strings. 2013-04-13 22:45:04 +03:00
Mark Dickinson 93196eb44f Issue #17715: Merge fix from 3.3. 2013-04-13 17:46:04 +01:00
Mark Dickinson c9734484ca Issue #17715: Add missing NULL Check to PyNumber_Long. 2013-04-13 17:44:44 +01:00
Mark Dickinson 556e94b8fe Issue #17643: Add __callback__ attribute to weakref.ref. 2013-04-13 15:45:44 +01:00
Mark Dickinson 548677bb8c Issue #16447: Merge fix from 3.3. 2013-04-13 15:30:16 +01:00
Mark Dickinson 64aafeb4de Issue #16447: Fix potential segfault when setting __name__ on a class. 2013-04-13 15:26:58 +01:00
Victor Stinner a0dd0213cc Close #17693: Rewrite CJK decoders to use the _PyUnicodeWriter API instead of
the legacy Py_UNICODE API.

Add also a new _PyUnicodeWriter_WriteChar() function.
2013-04-11 22:09:04 +02:00
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