Commit Graph

9979 Commits

Author SHA1 Message Date
Serhiy Storchaka 21fe721345 Fixed possible reference leaks in the _json module. 2017-01-03 11:17:44 +02:00
Berker Peksag 00b1ae0dfc Issue #28985: Update authorizer constants in sqlite3 module
Dates and version information from the changelog:

* 2006-08-12 (3.3.7) added SQLITE_CREATE_VTABLE, SQLITE_DROP_VTABLE
* 2006-10-09 (3.3.8) added SQLITE_FUNCTION
* 2009-01-12 (3.6.8) added SQLITE_SAVEPOINT
* 2014-02-03 (3.8.3) added SQLITE_RECURSIVE

Patch by Dingyuan Wang.
2017-01-02 06:38:10 +03:00
Benjamin Peterson e70ca463eb merge 3.6 (#29085) 2016-12-28 20:03:23 -08:00
Benjamin Peterson acc2f74ca9 fix error check, so that Random.seed actually uses OS randomness (closes #29085) 2016-12-28 20:02:35 -08:00
Steve Dower 280408bf1c Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto 2016-12-28 15:41:53 -08:00
Steve Dower bfce0f977d Issue #28768: Fix implicit declaration of function _setmode. Patch by Masayuki Yamamoto 2016-12-28 15:41:09 -08:00
Antoine Pitrou c06ae208eb Issue #28427: old keys should not remove new values from
WeakValueDictionary when collecting from another thread.
2016-12-27 14:34:54 +01:00
Antoine Pitrou d741ed492f Issue #28427: old keys should not remove new values from
WeakValueDictionary when collecting from another thread.
2016-12-27 14:23:43 +01:00
Antoine Pitrou e10ca3a0fe Issue #28427: old keys should not remove new values from
WeakValueDictionary when collecting from another thread.
2016-12-27 14:19:20 +01:00
Martin Panter 9e40afe20a Issue #29004: Merge crc_hqx() doc from 3.6 2016-12-24 07:45:56 +00:00
Martin Panter 520569e9bd Issue #29004: Merge crc_hqx() doc from 3.5 2016-12-24 07:44:03 +00:00
Martin Panter 3310e146cc Issue #29004: Document binascii.crc_hqx() implements CRC-CCITT 2016-12-24 07:36:44 +00:00
Serhiy Storchaka 47bdc40352 Merge from 3.6. 2016-12-21 12:36:29 +02:00
Serhiy Storchaka 690e81f63f Merge from 3.5. 2016-12-21 12:35:11 +02:00
Serhiy Storchaka 18f018ca12 Issue #28871: Fixed a crash when deallocate deep ElementTree. 2016-12-21 12:32:56 +02:00
Xiang Zhang b211068f5c Issue #28822: Adjust indices handling of PyUnicode_FindChar(). 2016-12-20 22:52:33 +08:00
INADA Naoki 6165d55f13 Issue #28147: Fix a memory leak in split-table dictionaries
setattr() must not convert combined table into split table.
2016-12-20 09:54:24 +09:00
Serhiy Storchaka 932ee73188 Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that
doesn't own its elements as limits.
2016-12-19 08:07:29 +02:00
Serhiy Storchaka 879199ba11 Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that
doesn't own its elements as limits.
2016-12-19 08:05:39 +02:00
Serhiy Storchaka b94eef2ae3 Issue #20191: Fixed a crash in resource.prlimit() when pass a sequence that
doesn't own its elements as limits.
2016-12-19 08:04:15 +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 5cc70c9935 Merge 3.6 2016-12-15 17:23:24 +01:00
Victor Stinner 3d3f264849 Fix a memory leak in split-table dictionaries
Issue #28147: Fix a memory leak in split-table dictionaries: setattr() must not
convert combined table into split table.

Patch written by INADA Naoki.
2016-12-15 17:21:23 +01:00
Victor Stinner cb2128cada _asyncio uses _PyObject_CallMethodIdObjArgs()
Issue #28920: Replace _PyObject_CallMethodId(obj, meth, "O", arg) with
_PyObject_CallMethodIdObjArgs(obj, meth, arg, NULL) to avoid
_PyObject_CallMethodId() special case when arg is a tuple.

If arg is a tuple, _PyObject_CallMethodId() unpacks the tuple: obj.meth(*arg).
2016-12-15 09:05:11 +01:00
Steve Dower 0885519914 Fixes maximum usable length of buffer for formatting time zone in localtime(). 2016-12-14 11:22:14 -08:00
Steve Dower c3c6f71662 Fixes maximum usable length of buffer for formatting time zone in localtime(). 2016-12-14 11:22:05 -08: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 5abaa2b139 Use PyObject_CallFunctionObjArgs()
Issue #28915: Replace PyObject_CallFunction() with
PyObject_CallFunctionObjArgs() when the format string was only made of "O"
formats, PyObject* arguments.

PyObject_CallFunctionObjArgs() avoids the creation of a temporary tuple and
doesn't have to parse a format string.
2016-12-09 16:22:32 +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 61bdb0d319 Use _PyObject_CallMethodIdObjArgs() in _io
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() 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 15:39:28 +01:00
Victor Stinner 20401deae2 Use _PyObject_CallMethodIdObjArgs() in _datetime
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() 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 15:24:31 +01:00
Victor Stinner f561634c82 Use _PyObject_CallMethodIdObjArgs() in _elementtree
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() 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 15:26:00 +01:00
Victor Stinner 5670764812 Use _PyObject_CallMethodIdObjArgs() in _ctypes
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() in unpickle(). _PyObject_CallMethodIdObjArgs()
avoids the creation of a temporary tuple and doesn't have to parse a format
string.

Replace _PyObject_CallMethodId() with _PyObject_GetAttrId()+PyObject_Call() for
the second call since it requires to "unpack" a tuple.

Add also a check in the type of the second parameter (state): it must be a
tuple.
2016-12-09 15:18:31 +01:00
Victor Stinner ddc120f4cf Fix refleak introduced in change 032cbdb596fe
Issue #28915.
2016-12-09 15:35:40 +01:00
Victor Stinner b6ed57d980 Use _PyObject_CallMethodIdObjArgs() in _asyncio
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() 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 14:24:02 +01:00
Victor Stinner 070c4d7ca7 Issue #28915: Use _PyObject_CallNoArg()
Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func).
2016-12-09 12:29:18 +01:00
Victor Stinner dbe28d26b4 time_strptime() uses PyObject_Call()
Issue #28915: Use PyObject_Call() to pass a tuple of positional arguments,
instead of relying on _PyObject_CallMethodId() weird behaviour to unpack the
tuple.
2016-12-09 00:38:53 +01:00
Victor Stinner 2b635971e7 build_struct_time() uses Py_BuildValue()
Issue #28915: Avoid calling _PyObject_CallMethodId() with "(...)" format to
avoid the creation of a temporary tuple: use Py_BuildValue() with
_PyObject_CallMethodIdObjArgs().
2016-12-09 00:38:16 +01:00
Victor Stinner 7e42541d08 Use _PyObject_CallMethodIdObjArgs()
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() when the format string only use the format 'O'
for objects, like "(O)".

_PyObject_CallMethodIdObjArgs() avoids the code to parse a format string and
avoids the creation of a temporary tuple.
2016-12-09 00:36:19 +01:00
Victor Stinner 4c38154a43 Don't parenthesis in _PyObject_CallMethodId() format
Issue #28915: Without parenthesis, _PyObject_CallMethodId() avoids the creation
a temporary tuple, and so is more efficient.
2016-12-09 00:33:39 +01:00
Serhiy Storchaka d7d266c113 Merge from 3.6. 2016-12-07 13:32:09 +02:00
Serhiy Storchaka 427f10b442 Merge from 3.5. 2016-12-07 13:31:47 +02:00
Serhiy Storchaka 606ab86c0e Change order of io.UnsupportedOperation base classes.
This makes tests passing after changes by issue #5322.
2016-12-07 13:31:20 +02:00
Victor Stinner f17c3de263 Use _PyObject_CallNoArg()
Replace:
    PyObject_CallFunctionObjArgs(callable, NULL)
with:
    _PyObject_CallNoArg(callable)
2016-12-06 18:46:19 +01:00
Victor Stinner a5ed5f000a Use _PyObject_CallNoArg()
Replace:
    PyObject_CallObject(callable, NULL)
with:
    _PyObject_CallNoArg(callable)
2016-12-06 18:45:50 +01:00
Victor Stinner 408bfa6d96 Issue #28152: Fix -Wunreachable-code warning on clang
Replace 0 with (0) to ignore a compiler warning about dead code on
"((int)(SEM_VALUE_MAX) < 0)": SEM_VALUE_MAX is not negative on Linux.
2016-12-05 18:00:42 +01:00
Victor Stinner 44d9bea1b8 Issue #28152: Fix -Wunreachable-code warning on clang
Replace C if() with precompiler #if to fix a warning on dead code when using
clang.
2016-12-05 17:55:36 +01:00
Victor Stinner 9a2329f9e1 Issue #28152: Fix -Wunreachable-code warnings on Clang
Don't declare dead code when the code is declared with Clang.
2016-12-05 17:56:36 +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
Victor Stinner de4ae3d486 Backed out changeset b9c9691c72c5
Issue #28858: The change b9c9691c72c5 introduced a regression. It seems like
_PyObject_CallArg1() uses more stack memory than
PyObject_CallFunctionObjArgs().
2016-12-04 22:59:09 +01:00
Yury Selivanov edfe8869c8 Merge 3.6 (issue #28843) 2016-12-01 11:37:47 -05:00
Yury Selivanov c2c8fe1252 Issue #28843: Fix asyncio C Task to handle exceptions __traceback__. 2016-12-01 11:36:22 -05: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
Victor Stinner 27580c1fb5 Replace PyObject_CallFunctionObjArgs() with fastcall
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func)
* PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg)

PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires
extra work to "parse" C arguments to build a C array of PyObject*.

_PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate
memory on the C stack.

This change is part of the fastcall project. The change on listsort() is
related to the issue #23507.
2016-12-01 14:43:22 +01:00
Victor Stinner 11dd6048aa Add TCP_CONGESTION and TCP_USER_TIMEOUT
Issue #26273: Add new socket.TCP_CONGESTION (Linux 2.6.13) and
socket.TCP_USER_TIMEOUT (Linux 2.6.37) constants.

Patch written by Omar Sandoval.
2016-11-29 16:55:04 +01:00
Victor Stinner 4f8dc3d15c Add TCP_CONGESTION and TCP_USER_TIMEOUT
Issue #26273: Add new socket.TCP_CONGESTION (Linux 2.6.13) and
socket.TCP_USER_TIMEOUT (Linux 2.6.37) constants.

Patch written by Omar Sandoval.
2016-11-29 16:55:04 +01:00
Victor Stinner 1018fad6a4 Issue #28792: Remove aliases from _bisect
Remove aliases from the C module. Always implement bisect() and insort()
aliases in bisect.py

Remove also the "# backward compatibility" command, there is no plan to
deprecate nor remove these aliases. When keys are equal, it makes sense to use
bisect.bisect() and bisect.insort().
2016-11-24 23:31:59 +01:00
Victor Stinner 726a57d45f Issue #28765: _sre.compile() now checks the type of groupindex and indexgroup
groupindex must a dictionary and indexgroup must be a tuple.

Previously, indexgroup was a list. Use a tuple to reduce the memory usage.
2016-11-22 23:04:39 +01:00
Victor Stinner 0b87b69a6e Merge 3.6 2016-11-22 15:30:53 +01:00
Victor Stinner bcf4dccfa7 Issue #28727: Optimize pattern_richcompare() for a==a
A pattern is equal to itself.
2016-11-22 15:30:38 +01:00
Victor Stinner e670b2d5c3 Issue #28727: Fix typo in pattern_richcompare()
Typo catched by Serhiy Storchaka, thanks!
2016-11-22 15:23:00 +01:00
Serhiy Storchaka e425bd95e9 Issue #28752: Restored the __reduce__() methods of datetime objects. 2016-11-22 00:30:32 +02:00
Serhiy Storchaka 546ce65968 Issue #28752: Restored the __reduce__() methods of datetime objects. 2016-11-22 00:29:42 +02:00
Victor Stinner 065507f03a Merge 3.6 2016-11-21 16:39:01 +01:00
Victor Stinner b44fb128ae Implement rich comparison for _sre.SRE_Pattern
Issue #28727: Regular expression patterns, _sre.SRE_Pattern objects created by
re.compile(), become comparable (only x==y and x!=y operators). This change
should fix the issue #18383: don't duplicate warning filters when the warnings
module is reloaded (thing usually only done in unit tests).
2016-11-21 16:35:08 +01:00
INADA Naoki 7fc69f2373 Issue #28532: Show sys.version when -V option is supplied twice 2016-11-21 20:58:10 +09:00
INADA Naoki 0e175a6e76 Issue #28532: Show sys.version when -V option is supplied twice 2016-11-21 20:57:14 +09:00
Martin Panter 7d6e9232b1 Issue #25659: Merge ctypes fix from 3.6 2016-11-20 22:17:44 +00:00
Martin Panter a57890e5ec Issue #10656: Merge AIX build fix from 3.6 2016-11-20 22:16:46 +00:00
Martin Panter 04b35753f7 Issue #25659: Merge ctypes fix from 3.5 2016-11-20 22:07:29 +00:00
Martin Panter e45df0a6da Issue #10656: Merge AIX build fix from 3.5 2016-11-20 22:06:44 +00:00
Serhiy Storchaka 460bd0d284 Issue #19569: Compiler warnings are now emitted if use most of deprecated
functions.
2016-11-20 12:16:46 +02: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
Martin Panter 6e723d2d11 Issue #25659: Change assert to TypeError in from_buffer/_copy()
Based on suggestion by Eryk Sun.
2016-11-20 07:58:35 +00:00
Martin Panter 395733d46b Issue #10656: Fix out-of-tree building on AIX
The ld_so_aix script and python.exp file are created in the build directory.
Patch by Tristan Carel and Michael Haubenwallner.
2016-11-20 07:56:37 +00:00
Serhiy Storchaka a98c4a984b Replaced outdated macros _PyUnicode_AsString and _PyUnicode_AsStringAndSize
with PyUnicode_AsUTF8 and PyUnicode_AsUTF8AndSize.
2016-11-20 09:13:40 +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 f6f1591808 Issue #28715: Added error checks for PyUnicode_AsUTF8(). 2016-11-20 08:48:30 +02:00
Serhiy Storchaka e20973926a Issue #28715: Added error checks for PyUnicode_AsUTF8(). 2016-11-20 08:48:07 +02:00
Serhiy Storchaka 144f77a981 Issue #28715: Added error checks for PyUnicode_AsUTF8(). 2016-11-20 08:47:21 +02:00
Steve Dower 83aeb3cc80 Issue #28732: Raise ValueError when argv[0] is empty 2016-11-19 19:17:46 -08:00
Steve Dower bce26262d1 Issue #28732: Raise ValueError when argv[0] is empty 2016-11-19 19:17:26 -08:00
Steve Dower 93ff8725b3 Issue #28732: Raise ValueError when argv[0] is empty. 2016-11-19 19:03:54 -08:00
Steve Dower 6f33e294e5 Issue #28732: Raise ValueError when os.spawn*() is passed an empty tuple of arguments 2016-11-19 18:53:36 -08:00
Steve Dower 859fd7bd7a Issue #28732: Raise ValueError when os.spawn*() is passed an empty tuple of arguments 2016-11-19 18:53:19 -08:00
Steve Dower 1325ee0938 Merge from 3.6 2016-11-19 18:41:31 -08:00
Steve Dower c3630612ab Merge from 3.5 and fix a few other functions missing IPH handling. 2016-11-19 18:41:16 -08:00
Steve Dower 11f4326ca1 Issue #28732: Fix crash in os.spawnv() with no elements in args
Prevents crashes in some other posixmodule.c functions
2016-11-19 18:33:39 -08:00
Serhiy Storchaka 1a73bf365e 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:57 +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
Benjamin Peterson 2294f83c7c merge 3.6 2016-11-14 00:15:52 -08:00
Benjamin Peterson 996fc1fcfc correctly emulate error semantics of gen.throw in FutureIter_throw 2016-11-14 00:15:44 -08:00
Martin Panter 5e17ad9716 Merge AIX fixes from 3.6 2016-11-14 05:04:36 +00:00
Martin Panter f8cebad290 Merge AIX fixes from 3.5 into 3.6 2016-11-14 05:04:12 +00:00
Martin Panter c9e08d8cb5 Issue #28000: Fix gethostbyname_r() usage on AIX with _LINUX_SOURCE_COMPAT
Patch by Matthieu S.
2016-11-14 04:26:36 +00:00
Serhiy Storchaka ac40c6c575 Issue #19398: Extra slash no longer added to sys.path components in case of
empty compile-time PYTHONPATH components.  This fixes some tests in -S or -I
modes.
2016-11-11 12:07:48 +02:00
Serhiy Storchaka a27c064428 Issue #19398: Extra slash no longer added to sys.path components in case of
empty compile-time PYTHONPATH components.  This fixes some tests in -S or -I
modes.
2016-11-11 12:06:38 +02:00
Serhiy Storchaka 62e32d6352 Issue #19398: Extra slash no longer added to sys.path components in case of
empty compile-time PYTHONPATH components.  This fixes some tests in -S or -I
modes.
2016-11-11 12:05:01 +02:00
Yury Selivanov 3e05a9c2b0 Merge 3.6 (issue #28653) 2016-11-09 18:57:00 -05:00