Commit Graph

223 Commits

Author SHA1 Message Date
Serhiy Storchaka 00987f6230
bpo-32011: Revert "Issue #15480: Remove the deprecated and unused TYPE_INT64 code from marshal." (#4381)
Simplify the reverted code.

This reverts commit e9bbe8b87b.
2017-11-15 17:41:05 +02:00
Benjamin Peterson c988ae01fe remove current_filename optimization from marshal (#3423) (closes bpo-31384) 2017-09-07 10:49:12 -07:00
Stefan Krah f432a3234f bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. (#3157) 2017-08-21 13:09:59 +02:00
Serhiy Storchaka 0767ad40bf bpo-20185: Convert the marshal module to Argument Clinic. (#541)
Based on patch by Vajrasky Kok.
2017-03-12 09:20:15 +02:00
Serhiy Storchaka c611a5b1d4 bpo-29746: Update marshal docs to Python 3. (#547) 2017-03-12 08:53:22 +02: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 4778eab1f2 Replace PyObject_CallFunction() with fastcall
Replace
    PyObject_CallFunction(func, "O", arg)
and
    PyObject_CallFunction(func, "O", arg, NULL)
with
    _PyObject_CallArg1(func, arg)

Replace
    PyObject_CallFunction(func, NULL)
with
    _PyObject_CallNoArg(func)

_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.
2016-12-01 14:51:04 +01:00
Christian Heimes f051e43b22 Issue #28126: Replace Py_MEMCPY with memcpy(). Visual Studio can properly optimize memcpy(). 2016-09-13 20:22:02 +02:00
Victor Stinner 5dacbd4c42 Cleanup hashtable.h
Issue #26588:

* Pass the hash table rather than the key size to hash and compare functions
* _Py_HASHTABLE_READ_KEY() and _Py_HASHTABLE_ENTRY_READ_KEY() macros now expect
  the hash table as the first parameter, rather than the key size
* tracemalloc_get_traces_fill(): use _Py_HASHTABLE_ENTRY_READ_DATA() rather
  than pointer dereference
* Remove the _Py_HASHTABLE_ENTRY_WRITE_PKEY() macro
* Move "PKEY" and "PDATA" macros inside hashtable.c
2016-03-23 09:52:13 +01:00
Victor Stinner e8c6b2fd1b Issue #26588:
* _Py_HASHTABLE_ENTRY_DATA: change type from "char *" to "const void *"
* Add _Py_HASHTABLE_ENTRY_WRITE_PKEY() macro
* Rename _Py_HASHTABLE_ENTRY_WRITE_DATA() macro to
  _Py_HASHTABLE_ENTRY_WRITE_PDATA()
* Add _Py_HASHTABLE_ENTRY_WRITE_DATA() macro
2016-03-23 09:25:01 +01:00
Victor Stinner 285cf0a601 hashtable.h now supports keys of any size
Issue #26588: hashtable.h now supports keys of any size, not only
sizeof(void*). It allows to support key larger than sizeof(void*), but also to
use less memory for key smaller than sizeof(void*).
2016-03-21 22:00:58 +01:00
Victor Stinner 322bc12c31 Ooops, revert changeset ea9efa06c137
Change pushed by mistake, the patch is still under review :-/

"""
_tracemalloc: add domain to trace keys

* hashtable.h: key has now a variable size
* _tracemalloc uses (pointer: void*, domain: unsigned int) as key for traces
"""
2016-03-21 14:36:39 +01:00
Victor Stinner 51b846c47a _tracemalloc: add domain to trace keys
* hashtable.h: key has now a variable size
* _tracemalloc uses (pointer: void*, domain: unsigned int) as key for traces
2016-03-18 21:52:22 +01:00
Victor Stinner 1aa78938b0 Issue #26146: marshal.loads() now uses the empty frozenset singleton 2016-01-23 14:15:48 +01: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 225821c653 Issue #25899: Converted non-ASCII characters in docstrings and manpage
to ASCII replacements.  Original patch by Chris Angelico.
2015-12-18 13:05:04 +02:00
Victor Stinner e134a7fe36 Issue #23752: _Py_fstat() is now responsible to raise the Python exception
Add _Py_fstat_noraise() function when a Python exception is not welcome.
2015-03-30 10:09:31 +02:00
Victor Stinner f329878e74 Issue #23753: Python doesn't support anymore platforms without stat() or
fstat(), these functions are always required.

Remove HAVE_STAT and HAVE_FSTAT defines, and stop supporting DONT_HAVE_STAT and
DONT_HAVE_FSTAT.
2015-03-24 10:27:50 +01:00
Steve Dower f2f373f593 Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
2015-02-21 08:44:05 -08:00
Serhiy Storchaka 26861b0b29 Issue #23450: Fixed possible integer overflows. 2015-02-16 20:52:17 +02:00
Serhiy Storchaka c07422c119 Splitted the WFILE structure to WFILE and RFILE. 2015-02-11 16:18:09 +02:00
Serhiy Storchaka c1efe5f039 Issue #23344: marshal.dumps() is now 20-25% faster on average. 2015-02-11 15:54:54 +02:00
Serhiy Storchaka ce921c62cc Issue #20416: marshal.dumps() with protocols 3 and 4 is now 40-50% faster on
average.
2015-02-11 15:53:31 +02:00
Serhiy Storchaka aaef05f003 Fixed memory leak in marshal. 2015-01-28 17:11:12 +02:00
Serhiy Storchaka 000daaee57 Fixed memory leak in marshal. 2015-01-28 17:10:48 +02:00
Serhiy Storchaka b757c83ec6 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:25:22 +02:00
Serhiy Storchaka 92bf919ed0 Issue #22581: Use more "bytes-like object" throughout the docs and comments. 2014-12-05 22:26:10 +02:00
Steve Dower f6c69e6cc9 #22734 marshal needs a lower stack depth for debug builds on Windows 2014-11-01 15:15:16 -07:00
Victor Stinner 45e8e2f218 Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY()
Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between
pyconfig.h and pymacros.h.
2014-05-14 17:24:35 +02:00
Victor Stinner da062558db Fix compiler warning (on Windows 64-bit): explicit cast Py_ssize_t to unsigned
char, n is in range [0; 255] (a tuple cannot have a negative length)
2013-11-16 00:13:29 +01:00
Victor Stinner 359fabc19f Issue #19437: Cleanup r_ref() of the marshal module 2013-10-31 17:09:01 +01:00
Victor Stinner d5cae6f143 Issue #19437: Fix r_object() of marshal module, handle PyDict_SetItem() failure
for TYPE_DICT and stop immedialty on first r_object() failure
2013-10-31 17:14:52 +01:00
Victor Stinner b1b7b1834b Issue #19437: Fix r_object() of marshal module, handle r_byte() failure for
TYPE_SMALL_TUPLE
2013-10-31 17:07:08 +01:00
Victor Stinner 763b0d19c9 Issue #19437: Fix r_PyLong() of marshal module, stop immediatly at first
failure, don't read any more data
2013-10-31 16:56:38 +01:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03:00
Antoine Pitrou 42c25f5581 Close #19260: remove outdated comment in marshal.c 2013-10-14 20:50:32 +02:00
Kristján Valur Jónsson 0a7697b718 Catch a few extra error cases in marshal.c 2013-10-13 15:19:56 +00:00
Kristján Valur Jónsson 5983258bf2 Issue #19219 Remove a lot of "retval = NULL" statements, now that retval
is pre-initialized to that value.  Test show a 5% speedup as a bonus.
2013-10-13 13:41:59 +00:00
Christian Heimes 3572842c19 Issue #19219: retval may be used uninitialized value
CID 486239: Uninitialized pointer read (UNINIT)
2013-10-13 02:29:06 +02:00
Antoine Pitrou b30f271299 Try to fix weird assertion error on the Fedora buildbot. 2013-10-12 23:14:47 +02:00
Antoine Pitrou 1164dfcb86 Issue #19219: Speed up marshal.loads(), and make pyc files slightly (5% to 10%) smaller. 2013-10-12 22:25:39 +02:00
Serhiy Storchaka 46e1ce214b Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 20:17:03 +03:00
Serhiy Storchaka 9594942716 Issue #18783: Removed existing mentions of Python long type in docstrings,
error messages and comments.
2013-08-27 19:40:23 +03:00
Antoine Pitrou 9ed5f27266 Issue #18722: Remove uses of the "register" keyword in C code. 2013-08-13 20:18:52 +02:00
Serhiy Storchaka f9e6672ae8 Issue #17872: Fix a segfault in marshal.load() when input stream returns
more bytes than requested.
2013-07-11 22:28:18 +03:00
Serhiy Storchaka 3641a74e1c Issue #17872: Fix a segfault in marshal.load() when input stream returns
more bytes than requested.
2013-07-11 22:20:47 +03:00
Serhiy Storchaka a155d40ed5 Fix reference leaks introduced by the patch for issue #5308. 2013-07-11 19:19:47 +03:00
Serhiy Storchaka dfde2151ed Fix reference leaks introduced by the patch for issue #5308. 2013-07-11 19:14:26 +03:00
Victor Stinner 3a8b79d4d2 Issue #18408: Fix marshal reader for Unicode strings: handle
PyUnicode_DecodeUTF8() failure (ex: MemoryError).
2013-07-08 22:23:32 +02:00
Victor Stinner f1913ca37f marshal: optimize parsing of empty Unicode strings
Don't create a temporary buffer of zeroy byte nor call r_string() if the length
is zero, create directly the empty string.
2013-06-21 19:08:06 +02:00