Serhiy Storchaka
986375ebde
bpo-28416: Break reference cycles in Pickler and Unpickler subclasses ( #4080 )
with the persistent_id() and persistent_load() methods.
8 years ago
Serhiy Storchaka
3daaafb700
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. ( #4407 )
8 years ago
Mat M
f76231f89a
bpo-32013: _pickle: Add missing Py_DECREF in error case in fast_save_enter() ( #4384 )
8 years ago
Serhiy Storchaka
04e36af9b8
bpo-31572: Get rid of using _PyObject_HasAttrId() in pickle. ( #3729 )
8 years ago
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.
8 years ago
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.
8 years ago
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.
8 years ago
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.
8 years ago
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).
8 years ago
Victor Stinner
af46eb8d5f
_pickle: Fix whichmodule() ( #3358 )
_PyUnicode_FromId() can return NULL: replace Py_INCREF() with
Py_XINCREF().
Fix coverity report: CID 1417269.
8 years ago
Eric Snow
86b7afdfee
bpo-28411: Remove "modules" field from Py_InterpreterState. ( #1638 )
sys.modules is the one true source.
8 years ago
Serhiy Storchaka
fff9a31a91
bpo-29865: Use PyXXX_GET_SIZE macros rather than Py_SIZE for concrete types. ( #748 )
9 years ago
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.
9 years ago
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.
9 years ago
Serhiy Storchaka
9937d90ee8
Issue #29190 : Fixed possible errors in comparing strings in the pickle module.
9 years ago
Serhiy Storchaka
5ab81d787f
Issue #28959 : Added private macro PyDict_GET_SIZE for retrieving the size of dict.
9 years ago
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.
9 years ago
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.
9 years ago
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.
9 years ago
Serhiy Storchaka
85b0f5beb1
Added the const qualifier to char* variables that refer to readonly internal
UTF-8 represenatation of Unicode objects.
9 years ago
Serhiy Storchaka
06515833fe
Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
9 years ago
Serhiy Storchaka
f4934ea77d
Issue #28701 : Replace PyUnicode_CompareWithASCIIString with _PyUnicode_EqualToASCIIString.
The latter function is more readable, faster and doesn't raise exceptions.
9 years ago
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.
9 years ago
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.
9 years ago
Raymond Hettinger
15f44ab043
Issue #27895 : Spelling fixes (Contributed by Ville Skyttä).
9 years ago
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).
9 years ago
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()
10 years ago
Victor Stinner
75210697ec
Issue #27128 : _pickle uses fast call
Use _PyObject_FastCall() to avoid the creation of temporary tuple.
10 years ago
Serhiy Storchaka
dec25afab1
Issue #17711 : Fixed unpickling by the persistent ID with protocol 0.
Original patch by Alexandre Vassalotti.
10 years ago
Serhiy Storchaka
1a2b24f02d
Issue #27332 : Fixed the type of the first argument of module-level functions
generated by Argument Clinic. Patch by Petr Viktorin.
10 years ago
Martin Panter
a90a4a9651
Issue #27125 : Remove duplicated words from documentation and comments
10 years ago
Martin Panter
46f50726a0
Issue #27076 : Doc, comment and tests spelling fixes
Most fixes to Doc/ and Lib/ directories by Ville Skyttä.
10 years ago
Victor Stinner
da23056a3e
Issue #27056 : Fix _Unpickler_Read() to avoid integer overflow
10 years ago
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.
10 years ago
Serhiy Storchaka
6a7b3a77b4
Issue #26778 : Fixed "a/an/and" typos in code comment and documentation.
10 years ago
Martin Panter
6245cb3c01
Correct “an” → “a” with “Unicode”, “user”, “UTF”, etc
This affects documentation, code comments, and a debugging messages.
10 years ago
Serhiy Storchaka
48842714b9
Issue #22570 : Renamed Py_SETREF to Py_XSETREF.
10 years ago
Victor Stinner
13f0c6166f
_pickle: Fix load_counted_tuple(), use Py_ssize_t for size
Fix a warning on Windows 64-bit.
10 years ago
Victor Stinner
21b47117ac
_pickle: Fix load_counted_tuple(), use Py_ssize_t for size
Fix a warning on Windows 64-bit.
10 years ago
Serhiy Storchaka
576f132b98
Issue #20440 : Cleaning up the code by using Py_SETREF.
10 years ago
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.
10 years ago
Serhiy Storchaka
ef1585eb9a
Issue #25923 : Added more const qualifiers to signatures of static and private functions.
10 years ago
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.
10 years ago
Serhiy Storchaka
3ac5380d24
Issue #25761 : Fixed reference leak added in previous changeset (5c670af0100f).
10 years ago
Serhiy Storchaka
59fb6342a4
Issue #25761 : Improved detecting errors in broken pickle data.
10 years ago
Serhiy Storchaka
ca28eba3d3
Fixed reference leak when read truncated pickle.
10 years ago
Serhiy Storchaka
a49de6be36
Issue #25725 : Fixed a reference leak in pickle.loads() when unpickling
invalid data including tuple instructions.
10 years ago
Serhiy Storchaka
e9b3074cf9
Issue #23914 : Fixed SystemError raised by unpickler on broken pickle data.
10 years ago
Victor Stinner
9ba97df69c
Closes #25645 : Fix a reference leak introduced by change bc5894a3a0e6 of the
issue #24164 .
10 years ago
Serhiy Storchaka
fad85aadb0
Issue #25558 : Use compile-time asserts.
10 years ago