Serhiy Storchaka
986375ebde
bpo-28416: Break reference cycles in Pickler and Unpickler subclasses ( #4080 )
...
with the persistent_id() and persistent_load() methods.
2017-11-30 22:48:31 +02:00
Serhiy Storchaka
3daaafb700
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. ( #4407 )
2017-11-16 09:44:43 +02:00
Mat M
f76231f89a
bpo-32013: _pickle: Add missing Py_DECREF in error case in fast_save_enter() ( #4384 )
2017-11-13 09:50:16 +02:00
Serhiy Storchaka
04e36af9b8
bpo-31572: Get rid of using _PyObject_HasAttrId() in pickle. ( #3729 )
2017-10-22 21:31:34 +03:00
Eric Snow
3f9eee6eb4
bpo-28411: Support other mappings in PyInterpreterState.modules. ( #3593 )
...
The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls.
We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication.
2017-09-15 16:35:20 -06:00
Barry Warsaw
b2e5794870
bpo-31338 ( #3374 )
...
* Add Py_UNREACHABLE() as an alias to abort().
* Use Py_UNREACHABLE() instead of assert(0)
* Convert more unreachable code to use Py_UNREACHABLE()
* Document Py_UNREACHABLE() and a few other macros.
2017-09-14 18:13:16 -07:00
Eric Snow
93c92f7d1d
bpo-31404: Revert "remove modules from Py_InterpreterState ( #1638 )" ( #3565 )
...
PR #1638 , for bpo-28411, causes problems in some (very) edge cases. Until that gets sorted out, we're reverting the merge. PR #3506 , a fix on top of #1638 , is also getting reverted.
2017-09-13 23:46:04 -07:00
Eric Snow
fc1bf872e9
bpo-30860: Move windows.h include out of internal/*.h. ( #3458 )
...
PR #3397 introduced a large number of warnings to the Windows build. This patch fixes them.
2017-09-11 18:30:43 -07:00
Eric Snow
2ebc5ce42a
bpo-30860: Consolidate stateful runtime globals. ( #3397 )
...
* group the (stateful) runtime globals into various topical structs
* consolidate the topical structs under a single top-level _PyRuntimeState struct
* add a check-c-globals.py script that helps identify runtime globals
Other globals are excluded (see globals.txt and check-c-globals.py).
2017-09-07 23:51:28 -06:00
Victor Stinner
af46eb8d5f
_pickle: Fix whichmodule() ( #3358 )
...
_PyUnicode_FromId() can return NULL: replace Py_INCREF() with
Py_XINCREF().
Fix coverity report: CID 1417269.
2017-09-05 14:30:16 -07:00
Eric Snow
86b7afdfee
bpo-28411: Remove "modules" field from Py_InterpreterState. ( #1638 )
...
sys.modules is the one true source.
2017-09-04 17:54:09 -06:00
Serhiy Storchaka
fff9a31a91
bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ( #748 )
2017-03-21 08:53:25 +02:00
Victor Stinner
fd6d0d2a18
Issue #29368 : Fix _Pickle_FastCall() usage in do_append()
...
_Pickle_FastCall() has a surprising API: it decrements the reference counter of
its second argument.
2017-02-02 10:56:47 +01:00
Serhiy Storchaka
bee09aecc2
Issue #29368 : The extend() method is now called instead of the append()
...
method when unpickle collections.deque and other list-like objects.
This can speed up unpickling to 2 times.
2017-02-02 11:12:47 +02:00
Serhiy Storchaka
32999ab48a
Issue #29190 : Fixed possible errors in comparing strings in the pickle module.
2017-01-09 10:10:07 +02:00
Serhiy Storchaka
f0f35a6720
Issue #29190 : Fixed possible errors in comparing strings in the pickle module.
2017-01-09 10:09:43 +02:00
Serhiy Storchaka
9937d90ee8
Issue #29190 : Fixed possible errors in comparing strings in the pickle module.
2017-01-09 10:04:34 +02:00
Serhiy Storchaka
5ab81d787f
Issue #28959 : Added private macro PyDict_GET_SIZE for retrieving the size of dict.
2016-12-16 16:18:57 +02:00
Victor Stinner
b110dad9ab
Initialize variables to fix compiler warnings
...
Warnings seen on the "AMD64 Debian PGO 3.x" buildbot. Warnings are false
positive, but variable initialization should not harm performances.
2016-12-09 17:06:43 +01:00
Victor Stinner
55ba38a480
Use _PyObject_CallMethodIdObjArgs()
...
Issue #28915 : Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() in various modules when the format string was
only made of "O" formats, PyObject* arguments.
_PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and
doesn't have to parse a format string.
2016-12-09 16:09:30 +01:00
Victor Stinner
7bfb42d5b7
Issue #28858 : Remove _PyObject_CallArg1() macro
...
Replace
_PyObject_CallArg1(func, arg)
with
PyObject_CallFunctionObjArgs(func, arg, NULL)
Using the _PyObject_CallArg1() macro increases the usage of the C stack, which
was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have this
issue.
2016-12-05 17:04:32 +01:00
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
...
UTF-8 represenatation of Unicode objects.
2016-11-20 10:16:47 +02:00
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
...
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:07 +02:00
Serhiy Storchaka
3b73ea1278
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
...
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:19:20 +02:00
Serhiy Storchaka
f4934ea77d
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
...
The latter function is more readable, faster and doesn't raise exceptions.
2016-11-16 10:17:58 +02:00
Serhiy Storchaka
90493ab30c
Issue #25761 : Improved error reporting about truncated pickle data in
...
C implementation of unpickler. UnpicklingError is now raised instead of
AttributeError and ValueError in some cases.
2016-09-06 23:55:11 +03:00
Victor Stinner
ad8c83ad6b
Avoid inefficient way to call functions without argument
...
Don't pass "()" format to PyObject_CallXXX() to call a function without
argument: pass NULL as the format string instead. It avoids to have to parse a
string to produce 0 argument.
2016-09-05 17:53:15 -07:00
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
2016-08-30 10:47:49 -07:00
Victor Stinner
b98b927e72
_pickle: remove outdated comment
...
_Pickle_FastCall() is now fast again!
The optimization was introduced in Python 3.2, removed in Python 3.4 and
reintroduced in Python 3.6 (thanks to the new generic fastcall functions).
2016-08-25 00:58:58 +02:00
Victor Stinner
559bb6a713
Rename _PyObject_FastCall() to _PyObject_FastCallDict()
...
Issue #27809 :
* Rename _PyObject_FastCall() function to _PyObject_FastCallDict()
* Add _PyObject_FastCall(), _PyObject_CallNoArg() and _PyObject_CallArg1()
macros calling _PyObject_FastCallDict()
2016-08-22 22:48:54 +02:00
Victor Stinner
75210697ec
Issue #27128 : _pickle uses fast call
...
Use _PyObject_FastCall() to avoid the creation of temporary tuple.
2016-08-19 18:59:15 +02:00
Serhiy Storchaka
3410c01d83
Issue #17711 : Fixed unpickling by the persistent ID with protocol 0.
...
Original patch by Alexandre Vassalotti.
2016-07-17 11:35:35 +03:00
Serhiy Storchaka
dec25afab1
Issue #17711 : Fixed unpickling by the persistent ID with protocol 0.
...
Original patch by Alexandre Vassalotti.
2016-07-17 11:24:17 +03:00
Serhiy Storchaka
2954f83999
- Issue #27332 : Fixed the type of the first argument of module-level functions
...
generated by Argument Clinic. Patch by Petr Viktorin.
2016-07-07 18:20:03 +03:00
Serhiy Storchaka
1a2b24f02d
Issue #27332 : Fixed the type of the first argument of module-level functions
...
generated by Argument Clinic. Patch by Petr Viktorin.
2016-07-07 17:35:15 +03:00
Martin Panter
e514093a2f
Issue #27125 : Merge typo fixes from 3.5
2016-05-30 05:24:49 +00:00
Martin Panter
a90a4a9651
Issue #27125 : Remove duplicated words from documentation and comments
2016-05-30 04:04:50 +00:00
Martin Panter
3e04d5b306
Issue #27076 : Merge spelling from 3.5
2016-05-26 06:03:19 +00:00
Martin Panter
46f50726a0
Issue #27076 : Doc, comment and tests spelling fixes
...
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
2016-05-26 05:35:26 +00:00
Victor Stinner
da23056a3e
Issue #27056 : Fix _Unpickler_Read() to avoid integer overflow
2016-05-20 21:16:59 +02:00
Victor Stinner
19ed27ec2b
Optimize pickle.load() and pickle.loads()
...
Issue #27056 : Optimize pickle.load() and pickle.loads(), up to 10% faster to
deserialize a lot of small objects.
2016-05-20 11:42:37 +02:00
Serhiy Storchaka
b6a9c9761c
Issue #26778 : Fixed "a/an/and" typos in code comment, documentation and error
...
messages.
2016-04-17 09:39:28 +03:00
Serhiy Storchaka
6a7b3a77b4
Issue #26778 : Fixed "a/an/and" typos in code comment and documentation.
2016-04-17 08:32:47 +03:00
Martin Panter
cda80940ed
Issue #15984 : Merge PyUnicode doc from 3.5
2016-04-15 02:27:11 +00:00
Martin Panter
6245cb3c01
Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
...
This affects documentation, code comments, and a debugging messages.
2016-04-15 02:14:19 +00:00
Serhiy Storchaka
ec39756960
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:50:03 +03:00
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
2016-04-06 09:45:48 +03:00
Victor Stinner
21b47117ac
_pickle: Fix load_counted_tuple(), use Py_ssize_t for size
...
Fix a warning on Windows 64-bit.
2016-03-14 18:09:39 +01:00
Serhiy Storchaka
576f132b98
Issue #20440 : Cleaning up the code by using Py_SETREF.
2016-01-05 21:27:54 +02:00
Serhiy Storchaka
bdb908ea54
Issue #20440 : Applied yet one patch for using Py_SETREF.
...
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
2015-12-27 12:38:28 +02:00
Serhiy Storchaka
4a1e70fc31
Issue #20440 : Applied yet one patch for using Py_SETREF.
...
The patch is automatically generated, it replaces the code that uses Py_CLEAR.
2015-12-27 12:36:18 +02:00
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
2015-12-25 20:01:53 +02:00
Serhiy Storchaka
a9406e77fa
Issue #25421 : __sizeof__ methods of builtin types now use dynamic basic size.
...
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:07:11 +02:00
Serhiy Storchaka
5c4064e8bd
Issue #25421 : __sizeof__ methods of builtin types now use dynamic basic size.
...
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Serhiy Storchaka
3ac5380d24
Issue #25761 : Fixed reference leak added in previous changeset (5c670af0100f).
2015-12-07 11:32:00 +02:00
Serhiy Storchaka
59fb6342a4
Issue #25761 : Improved detecting errors in broken pickle data.
2015-12-06 22:01:35 +02:00
Serhiy Storchaka
fbc3e374a6
Fixed reference leak when read truncated pickle.
2015-12-01 00:20:49 +02:00
Serhiy Storchaka
77a61d292a
Fixed reference leak when read truncated pickle.
2015-12-01 00:20:36 +02:00
Serhiy Storchaka
ca28eba3d3
Fixed reference leak when read truncated pickle.
2015-12-01 00:18:23 +02:00
Serhiy Storchaka
14128d8bc5
Issue #25725 : Fixed a reference leak in pickle.loads() when unpickling
...
invalid data including tuple instructions.
2015-11-25 15:07:36 +02:00
Serhiy Storchaka
c5f3b4285a
Issue #25725 : Fixed a reference leak in pickle.loads() when unpickling
...
invalid data including tuple instructions.
2015-11-25 15:06:49 +02:00
Serhiy Storchaka
a49de6be36
Issue #25725 : Fixed a reference leak in pickle.loads() when unpickling
...
invalid data including tuple instructions.
2015-11-25 15:01:53 +02:00
Serhiy Storchaka
b1ce30281d
Issue #23914 : Fixed SystemError raised by unpickler on broken pickle data.
2015-11-23 15:20:21 +02:00
Serhiy Storchaka
4409c6cfae
Issue #23914 : Fixed SystemError raised by unpickler on broken pickle data.
2015-11-23 15:19:23 +02:00
Serhiy Storchaka
e9b3074cf9
Issue #23914 : Fixed SystemError raised by unpickler on broken pickle data.
2015-11-23 15:17:43 +02:00
Victor Stinner
9ba97df69c
Closes #25645 : Fix a reference leak introduced by change bc5894a3a0e6 of the
...
issue #24164 .
2015-11-17 12:15:07 +01:00
Serhiy Storchaka
fad85aadb0
Issue #25558 : Use compile-time asserts.
2015-11-07 15:42:38 +02:00
Martin Panter
e56a919100
Issue #25523 : Merge a-to-an corrections from 3.5
2015-11-02 04:27:17 +00:00
Martin Panter
2eb819f7a8
Issue #25523 : Merge "a" to "an" fixes from 3.4 into 3.5
2015-11-02 04:04:57 +00:00
Martin Panter
7462b64911
Issue #25523 : Correct "a" article to "an" article
...
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Victor Stinner
358af13526
Issue #25353 : Optimize unicode escape and raw unicode escape encoders to use
...
the new _PyBytesWriter API.
2015-10-12 22:36:57 +02:00
Serhiy Storchaka
0d554d7ef1
Issue #24164 : Objects that need calling ``__new__`` with keyword arguments,
...
can now be pickled using pickle protocols older than protocol version 4.
2015-10-10 22:42:18 +03:00
Serhiy Storchaka
525faaeffc
Issue #25262 . Added support for BINBYTES8 opcode in Python implementation of
...
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
2015-09-29 22:12:29 +03:00
Serhiy Storchaka
e060619d4b
Issue #25262 . Added support for BINBYTES8 opcode in Python implementation of
...
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8
opcodes no longer silently ignored on 32-bit platforms in C implementation.
2015-09-29 22:10:07 +03:00
Benjamin Peterson
bdb93c3e63
merge 3.4 ( #25245 )
2015-09-27 01:16:12 -07:00
Benjamin Peterson
6aa1564e9c
initialize return value to NULL to avoid compiler compliants ( closes #25245 )
2015-09-27 01:16:03 -07:00
Benjamin Peterson
03c59b9bef
merge 3.4
2015-09-26 00:09:32 -07:00
Benjamin Peterson
e48cf7e729
prevent overflow in _Unpickler_Read
2015-09-26 00:08:34 -07:00
Yury Selivanov
f488fb422a
Issue #19235 : Add new RecursionError exception. Patch by Georg Brandl.
2015-07-03 01:04:23 -04:00
Benjamin Peterson
42e913aa3a
merge 3.4 ( #24552 )
2015-07-02 16:18:58 -05:00
Benjamin Peterson
80f78a3efc
fix use after free ( closes #24552 )
2015-07-02 16:18:38 -05:00
Benjamin Peterson
7763c68dcd
merge 3.4
2015-06-27 14:18:23 -05:00
Benjamin Peterson
ff0f322edb
merge 3.3
2015-06-27 13:56:46 -05:00
Benjamin Peterson
59b08c18a8
use safe allocation and reallocation macros
2015-06-27 13:41:33 -05:00
Larry Hastings
89964c48d1
Issue #23944 : Argument Clinic now wraps long impl prototypes at column 78.
2015-04-14 18:07:59 -04:00
Serhiy Storchaka
1009bf18b3
Issue #23501 : Argumen Clinic now generates code into separate files by default.
2015-04-03 23:53:51 +03:00
Serhiy Storchaka
58e4134a1c
Issue #23611 : Serializing more "lookupable" objects (such as unbound methods
...
or nested classes) now are supported with pickle protocols < 4.
2015-03-31 14:07:24 +03:00
Serhiy Storchaka
d5d818d40b
Issue #18473 : Fixed 2to3 and 3to2 compatible pickle mappings.
...
Fixed ambigious reverse mappings. Added many new mappings. Import mapping
is no longer applied to modules already mapped with full name mapping.
Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
2015-03-31 13:17:10 +03:00
Serhiy Storchaka
bfe1824d08
Issue #18473 : Fixed 2to3 and 3to2 compatible pickle mappings.
...
Fixed ambigious reverse mappings. Added many new mappings. Import mapping
is no longer applied to modules already mapped with full name mapping.
Added tests for compatible pickling and unpickling and for consistency of
_compat_pickle mappings.
2015-03-31 13:12:37 +03:00
Serhiy Storchaka
c86ca26d32
Issue #23096 : Pickle representation of floats with protocol 0 now is the same
...
for both Python and C implementations.
2015-02-15 14:18:32 +02:00
Serhiy Storchaka
707b5ccde5
Issue #22783 : Pickling now uses the NEWOBJ opcode instead of the NEWOBJ_EX
...
opcode if possible.
2014-12-16 19:43:46 +02:00
Serhiy Storchaka
01bdd9a980
Issue #15513 : Added a __sizeof__ implementation for pickle classes.
2014-12-16 19:40:58 +02:00
Serhiy Storchaka
5bbd231f27
Issue #15513 : Added a __sizeof__ implementation for pickle classes.
2014-12-16 19:39:08 +02:00
Antoine Pitrou
6cd5eda0dd
Fix uninitialized variable after #22676 .
2014-12-02 00:20:03 +01:00
Antoine Pitrou
fce60eaf15
Issue #22676 : Make the pickling of global objects which don't have a __module__ attribute less slow.
2014-10-23 22:47:50 +02:00
Serhiy Storchaka
67c719b34b
Silenced some warnings about comparison between signed and unsigned integer
...
expressions.
2014-09-05 10:10:23 +03:00
Victor Stinner
049e509a9f
Issue #22207 : Fix "comparison between signed and unsigned integers" warning in
...
test checking for integer overflow on Py_ssize_t type: cast explicitly to
size_t.
2014-08-17 22:20:00 +02:00
Victor Stinner
7270b7f1aa
_pickle: Optimize raw_unicode_escape(), use directly a bytes object, don't use
...
a temporary bytearray object.
2014-08-17 21:14:46 +02:00
Victor Stinner
f13c46cc69
Issue #22218 : Fix "comparison between signed and unsigned integers" warnings in
...
Modules/_pickle.c.
2014-08-17 21:05:55 +02:00
Larry Hastings
581ee3618c
Issue #20326 : Argument Clinic now uses a simple, unique signature to
...
annotate text signatures in docstrings, resulting in fewer false
positives. "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.
Issue #20326 : Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
2014-01-28 05:00:08 -08:00