Commit Graph

10444 Commits

Author SHA1 Message Date
Serhiy Storchaka 9326028115 Issue #20185: Converted the gc module to Argument Clinic. 2017-02-04 11:19:59 +02:00
Serhiy Storchaka a5a55902c1 Issue #29300: Use Argument Clinic for getting struct object from the format. 2017-02-04 11:14:52 +02:00
Victor Stinner c0f59ad145 Rename struct.unpack() 2nd parameter to "buffer"
Issue #29300: Rename struct.unpack() second parameter from "inputstr" to
"buffer", and use the Py_buffer type.

Fix also unit tests on struct.unpack() which passed a Unicode string instead of
a bytes string as struct.unpack() second parameter. The purpose of
test_trailing_counter() is to test invalid format strings, not to test the
buffer parameter.
2017-02-02 14:24:16 +01:00
Victor Stinner 3f2d10132d Issue #29300: Convert _struct module to Argument Clinic
* The struct module now requires contiguous buffers.
* Convert most functions and methods of the _struct module to Argument Clinic
* Use "Py_buffer" type for the "buffer" argument. Argument Clinic is
  responsible to create and release the Py_buffer object.
* Use "PyStructObject *" type for self to avoid explicit conversions.
* Add an unit test on the _struct.Struct.unpack_from() method to test passing
  arguments as keywords.
* Rephrase docstrings.
* Rename "fmt" argument to "format" in docstrings and the documentation.

As a side effect, functions and methods which used METH_VARARGS calling
convention like struct.pack() now use the METH_FASTCALL calling convention
which avoids the creation of temporary tuple to pass positional arguments and
so is faster. For example, struct.pack("i", 1) becomes 1.56x faster (-36%)::

    $ ./python -m perf timeit \
        -s 'import struct; pack=struct.pack' 'pack("i", 1)' \
        --compare-to=../default-ref/python
    Median +- std dev: 119 ns +- 1 ns -> 76.8 ns +- 0.4 ns: 1.56x faster (-36%)
    Significant (t=295.91)

Patch co-written with Serhiy Storchaka.
2017-02-02 12:09:30 +01: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
Benjamin Peterson 2145387abc merge 3.6 (#29398) 2017-01-31 23:31:20 -08:00
Benjamin Peterson 2b3f4c1efb merge 3.5 (#29398) 2017-01-31 23:31:10 -08:00
Benjamin Peterson ec977c3028 gc types needs to be allocated as such (closes #29398) 2017-01-31 23:31:02 -08:00
doko@ubuntu.com 9ac4815240 merge 3.6 2017-01-31 13:53:39 +01:00
doko@ubuntu.com cd12f7cb5c merge 3.5 2017-01-31 13:51:21 +01:00
doko@ubuntu.com 34e7e2ecb1 - Issue #29169: Update zlib to 1.2.10. 2017-01-31 13:49:48 +01:00
Martin Panter 3f16f57ea4 Issue #29384: Remove Be OS scripts from Modules/, unused in 3.0+ 2017-01-29 10:21:57 +00:00
Serhiy Storchaka d1302c0154 Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible but Coccinelle couldn't find opportunity.
2017-01-23 10:23:58 +02:00
Serhiy Storchaka 228b12edcc Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible.  Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Serhiy Storchaka 2a404b63d4 Issue #28769: The result of PyUnicode_AsUTF8AndSize() and PyUnicode_AsUTF8()
is now of type "const char *" rather of "char *".
2017-01-22 23:07:07 +02:00
Xiang Zhang 1dfaa6c38a Issue #29092: Merge 3.6. 2017-01-22 13:10:12 +08:00
Xiang Zhang 4459e009ed Issue #29092: Sync os.stat's doc and docstring on path type. 2017-01-22 13:04:17 +08:00
Mark Dickinson 5e65cd39df Issue #29282: Backed out changeset b33012ef1417 2017-01-21 13:10:52 +00:00
Mark Dickinson d1b230e48b Issue #29282: add fused multiply-add function, math.fma. 2017-01-21 12:35:30 +00:00
Serhiy Storchaka c9ea933586 Issue #20186: Converted the math module to Argument Clinic.
Patch by Tal Einat.
2017-01-19 18:13:09 +02:00
Serhiy Storchaka b813a0e948 Issue #20186: Converted the _operator module to Argument Clinic.
Patch by Tal Einat.
2017-01-19 17:44:13 +02:00
Gregory P. Smith 8128d5a491 Address a minor Coverity warning re: unchecked PyArg_ParseTuple calls
in socket.sendto().  A PyErr_Occurred() check was happening later, but
it is better to just use the return value and not call PyErr_Occurred().
2017-01-17 16:54:56 -08:00
Victor Stinner aeaf294608 _hashopenssl uses METH_FASTCALL 2017-01-17 04:20:26 +01:00
Victor Stinner 0c4a828cad Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling
convention for functions using "boring" positional arguments.

Manually fix _elementtree: _elementtree_XMLParser_doctype() must remain
consistent with the clinic code.
2017-01-17 02:21:47 +01:00
Victor Stinner 259f0e4437 Run Argument Clinic: METH_VARARGS=>METH_FASTCALL
Issue #29286. Run Argument Clinic to get the new faster METH_FASTCALL calling
convention for functions using only positional arguments.
2017-01-17 01:35:17 +01:00
Victor Stinner 3e1fad6913 Rename _PyArg_ParseStack to _PyArg_ParseStackAndKeywords
Issue #29286.
2017-01-17 01:29:01 +01:00
Benjamin Peterson 510df6f272 merge 3.6 2017-01-16 00:05:54 -08:00
Benjamin Peterson 741c45adab merge 3.5 2017-01-16 00:05:47 -08:00
Benjamin Peterson a105dd3dc0 generate spaces instead of tabs into config.c 2017-01-16 00:05:12 -08:00
Martin Panter 446a498a63 Merge doc fixes from 3.6 2017-01-14 09:56:00 +00:00
Martin Panter 4659ddc433 Merge doc fixes from 3.5 2017-01-14 09:54:57 +00:00
Martin Panter 536d70ed33 Fix grammar, typos and markup in documentation and code comments
* Indent versionchanged at method level, not class level
* Mark up ``--help`` to avoid generating an en dash
* Use forward slash in Unix command line with a dollar sign ($) prompt
2017-01-14 08:23:08 +00:00
Serhiy Storchaka b37f3f6e6b Issue #29195: Removed support of deprecated undocumented keyword arguments
in methods of regular expression objects.
2017-01-13 08:53:58 +02:00
Serhiy Storchaka 8cbc51ab3d Py_SIZE() was misused for dict. 2017-01-13 08:38:15 +02:00
Serhiy Storchaka a6758427fd Py_SIZE() was misused for dict. 2017-01-13 08:37:05 +02:00
Serhiy Storchaka 3023ebb43f Py_SIZE() was misused for dict. 2017-01-13 08:34:34 +02:00
Raymond Hettinger a24dca6a90 Fix typo 2017-01-12 22:25:25 -08:00
Serhiy Storchaka 617c7753ce Issue #28969: Fixed race condition in C implementation of functools.lru_cache.
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:42:20 +02:00
Serhiy Storchaka 42e1ea9a10 Issue #28969: Fixed race condition in C implementation of functools.lru_cache.
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 19:12:21 +02:00
Serhiy Storchaka 67796521dd Issue #28969: Fixed race condition in C implementation of functools.lru_cache.
KeyError could be raised when cached function with full cache was
simultaneously called from differen threads with the same uncached arguments.
2017-01-12 18:34:33 +02:00
Raymond Hettinger 68191f8a9c Backed out changeset ea064ff3c10f 2017-01-09 07:39:46 -08:00
Stefan Krah 3c29fd0074 While a speedup of 1% is measurable, contexts aren't created that often,
so let's defer this until 3.7, 3.8, ... all have this new function.
2017-01-09 13:53:32 +01:00
Stefan Krah a40a3f35eb Merge 3.6. 2017-01-09 13:12:09 +01:00
Stefan Krah e660335b7e Merge 3.5. 2017-01-09 13:11:51 +01:00
Stefan Krah 18e0a97a1a Issue #28701: Revert part of 5bdc8e1a50c8 for the following reasons:
- There was no real problem to begin with.

  - The hypothetical problem has been fixed by 5bdc8e1a50c8.
2017-01-09 13:11:27 +01: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
Raymond Hettinger 9d60b94427 Sync-up lru_cache() C code with space saving feature in the Python version. 2017-01-08 19:34:28 -08:00
Raymond Hettinger dda44682c6 Complete the merge for issue #29203 2017-01-08 18:04:30 -08:00
Raymond Hettinger 4ee39141e8 Issue #29203: functools.lru_cache() now respects PEP 468 2017-01-08 17:28:20 -08:00
Xiang Zhang ce16c6827c Issue #29034: Merge 3.6. 2017-01-08 23:30:05 +08:00
Xiang Zhang 04316c4cc8 Issue #29034: Fix memory leak and use-after-free in path_converter. 2017-01-08 23:26:57 +08:00
Stefan Krah aaa67862e8 Merge 3.6. 2017-01-08 01:36:46 +01:00
Stefan Krah 0b64a0fc64 Add comment why the change in d83884b3a427 wasn't necessary. 2017-01-08 01:36:00 +01:00
Stefan Krah f4df2ee78c Merge 3.6. 2017-01-08 01:11:50 +01:00
Stefan Krah dada5a8d75 Revert part of 3cb3e224b692 in code that I maintain. 2017-01-08 01:11:27 +01:00
Stefan Krah 45ed522237 Revert part of dbf72357cb4a that is in a rarely used path and causes
maintenance issues (cost/benefit).
2017-01-08 00:08:53 +01:00
Stefan Krah 2b938f84f4 Revert (unauthorized) parts of 54a89144ee1d which are not in a speed-sensitive
path in order to avoid maintenance issues.
2017-01-08 00:02:15 +01:00
Stefan Krah 1b5fa6b7c9 Revert (unauthorized) parts of b9eb35435178 which are not in a speed-sensitive
path and cause maintenance issues (3.6 <-> 3.7, private test suite).
2017-01-07 23:20:27 +01:00
Victor Stinner 12bc0274a8 Merge 3.6 2017-01-03 23:47:39 +01:00
Victor Stinner 423c16b4c3 Issue #29140: Fix hash(datetime.time)
Fix time_hash() function: replace DATE_xxx() macros with TIME_xxx() macros.
Before, the hash function used a wrong value for microseconds if fold is set
(equal to 1).
2017-01-03 23:47:12 +01:00
Serhiy Storchaka 0f05512104 Fixed possible reference leaks in the _json module. 2017-01-03 11:20:15 +02:00
Serhiy Storchaka 8d979d576e Fixed possible reference leaks in the _json module. 2017-01-03 11:19:48 +02:00
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
Yury Selivanov 0a66a1cdd6 Merge 3.6 (issue #28653) 2016-11-09 18:56:26 -05:00
Yury Selivanov 46a02db90b Issue #28653: Fix a refleak in functools.lru_cache. 2016-11-09 18:55:45 -05:00
Yury Selivanov bff8f647a9 Merge 3.6 (issue #26081) 2016-11-08 19:05:42 -05:00
Yury Selivanov 692796a948 Issue #26081: Fix refleak in _asyncio.Future.__iter__().throw. 2016-11-08 19:04:57 -05:00
Serhiy Storchaka b74fecc396 Issue #28585: Restored docstring of os._isdir(). 2016-11-08 20:28:43 +02:00
Serhiy Storchaka 852cc3335e Issue #28585: Restored docstring of os._isdir(). 2016-11-08 20:26:18 +02:00
Serhiy Storchaka 579f038018 Issue #28585: Restored docstring of os._isdir(). 2016-11-08 20:21:22 +02:00
Serhiy Storchaka 85bcf37e15 Issue #23996: Added _PyGen_SetStopIterationValue for safe raising
StopIteration with value. More safely handle non-normalized exceptions
in -_PyGen_FetchStopIterationValue.
2016-11-06 18:47:35 +02:00
Serhiy Storchaka 60e49aa756 Issue #23996: Added _PyGen_SetStopIterationValue for safe raising
StopIteration with value. More safely handle non-normalized exceptions
in -_PyGen_FetchStopIterationValue.
2016-11-06 18:47:03 +02:00
Serhiy Storchaka f0b311bd73 Issue #28123: _PyDict_GetItem_KnownHash() now can raise an exception as
PyDict_GetItemWithError().  Patch by Xiang Zhang.
2016-11-06 13:18:24 +02:00
Serhiy Storchaka 5f548a24a4 Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when
the garbage collector is invoked in other thread.
Based on patch by Sebastian Cufre.
2016-11-03 15:38:17 +02:00
Serhiy Storchaka a7c972e03b Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when
the garbage collector is invoked in other thread.
Based on patch by Sebastian Cufre.
2016-11-03 15:37:01 +02:00
Serhiy Storchaka 88b2219358 Issue #27517: LZMA compressor and decompressor no longer raise exceptions if
given empty data twice.  Patch by Benjamin Fogle.
2016-10-31 08:31:13 +02:00
Serhiy Storchaka 04f17f103a Issue #27517: LZMA compressor and decompressor no longer raise exceptions if
given empty data twice.  Patch by Benjamin Fogle.
2016-10-31 08:30:09 +02:00
Serhiy Storchaka a0d9c685d0 Issue #28549: Fixed segfault in curses's addch() with ncurses6. 2016-10-30 22:53:09 +02:00
Serhiy Storchaka 0bcd89b859 Issue #28549: Fixed segfault in curses's addch() with ncurses6. 2016-10-30 22:52:06 +02:00
Xavier de Gaye 0eacef3ecf Issue #28444: Merge with 3.5. 2016-10-29 16:59:32 +02:00
Xavier de Gaye 84968b74c8 Issue #28444: Fix missing extensions modules when cross compiling. 2016-10-29 16:57:20 +02:00
Serhiy Storchaka 49d02d1659 Issue #28586: Converted os.scandir() to Argument Clinic. 2016-11-06 13:45:33 +02:00
Serhiy Storchaka 04230c4087 Issue #28123: _PyDict_GetItem_KnownHash() now can raise an exception as
PyDict_GetItemWithError().  Patch by Xiang Zhang.
2016-11-06 13:19:38 +02:00
Serhiy Storchaka d63f1f757c Issue #28387: Fixed possible crash in _io.TextIOWrapper deallocator when
the garbage collector is invoked in other thread.
Based on patch by Sebastian Cufre.
2016-11-03 15:38:58 +02:00
Serhiy Storchaka ecf40c1dce Issue #27517: LZMA compressor and decompressor no longer raise exceptions if
given empty data twice.  Patch by Benjamin Fogle.
2016-10-31 08:31:41 +02:00
Serhiy Storchaka e1ac09d137 Issue #28549: Fixed segfault in curses's addch() with ncurses6. 2016-10-30 22:54:23 +02:00
Xavier de Gaye 0af10ac472 Issue #28444: Merge with 3.6. 2016-10-29 17:01:07 +02:00
Victor Stinner 43a5c1c9d3 Merge 3.6 2016-10-29 09:11:06 +02:00
Victor Stinner f94d1eee74 Issue #28544: Fix inefficient call to _PyObject_CallMethodId()
"()" format string creates an empty list of argument but requires extra work to
parse the format string.
2016-10-29 09:05:39 +02:00
Yury Selivanov f0bbee6228 Merge 3.6 (issue #28544) 2016-10-28 19:01:46 -04:00
Yury Selivanov 684ef2c888 Issue #28544: Pass `PyObject*` to _PyDict_Pop, not `PyDictObject*` 2016-10-28 19:01:21 -04:00
Victor Stinner 1e03d8cc12 Merge 3.6 2016-10-28 19:15:08 +02:00
Victor Stinner 1aea8fb9e0 Issue #28544: Fix _asynciomodule.c on Windows
PyType_Ready() sets the reference to &PyType_Type.

&PyType_Type cannot be resolved at compilation time (not on Windows?).
2016-10-28 19:13:52 +02:00
Yury Selivanov 29d3cbfe97 Merge 3.6 (issue #28544) 2016-10-28 12:53:29 -04:00
Yury Selivanov a0c1ba608e Issue #28544: Implement asyncio.Task in C.
This implementation provides additional 10-20% speed boost for
asyncio programs.

The patch also fixes _asynciomodule.c to use Arguments Clinic, and
makes '_schedule_callbacks' an overridable method (as it was in 3.5).
2016-10-28 12:52:37 -04:00
Serhiy Storchaka 3809c25bc3 Fixed possible NULL decrefing. 2016-10-28 12:17:17 +03:00
Serhiy Storchaka 8a8ebc900a Fixed possible NULL decrefing. 2016-10-28 12:16:21 +03:00
Serhiy Storchaka 3ec5f421c5 Fixed possible NULL decrefing. 2016-10-28 12:14:34 +03:00
Serhiy Storchaka 9e7d6a9d5e Issue #28526: Use PyUnicode_AsEncodedString() instead of
PyUnicode_AsEncodedObject() in _curese to ensure that the result
is a bytes object.
2016-10-27 19:33:22 +03:00
Serhiy Storchaka 802426f99b Issue #28526: Use PyUnicode_AsEncodedString() instead of
PyUnicode_AsEncodedObject() in _curese to ensure that the result
is a bytes object.
2016-10-27 19:33:05 +03:00
Serhiy Storchaka b29cee40ee Issue #28526: Use PyUnicode_AsEncodedString() instead of
PyUnicode_AsEncodedObject() in _curese to ensure that the result
is a bytes object.
2016-10-27 19:31:49 +03:00
INADA Naoki 12a98e8cbb Issue #28430: Fix iterator of C implemented asyncio.Future doesn't
accept non-None value is passed to it.send(val).
2016-10-25 19:11:40 +09:00
INADA Naoki 74c17539f2 Issue #28430: Fix iterator of C implemented asyncio.Future doesn't
accept non-None value is passed to it.send(val).
2016-10-25 19:00:45 +09:00
Serhiy Storchaka f8d7d41507 Issue #28511: Use the "U" format instead of "O!" in PyArg_Parse*. 2016-10-23 15:12:25 +03:00
Serhiy Storchaka 14ab277632 Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raising
new exception with setting current exception as __cause__.

_PyErr_FormatFromCause(exception, format, args...) is equivalent to Python

    raise exception(format % args) from sys.exc_info()[1]
2016-10-21 17:10:42 +03:00
Serhiy Storchaka 467ab194fc Issue #28410: Added _PyErr_FormatFromCause() -- the helper for raising
new exception with setting current exception as __cause__.

_PyErr_FormatFromCause(exception, format, args...) is equivalent to Python

    raise exception(format % args) from sys.exc_info()[1]
2016-10-21 17:09:17 +03:00
Martin Panter ccb2c0e310 Issue #23214: Implement optional BufferedReader, BytesIO read1() argument 2016-10-20 23:48:14 +00:00
Yury Selivanov dc5061fe10 Merge 3.6 (issue #28493) 2016-10-20 16:33:39 -04:00
Yury Selivanov 53478f8c6d Issue #28493: Fix typos in _asynciomodule.c
Thanks to Stéphane Wirtel!
2016-10-20 16:33:19 -04:00
Yury Selivanov 3ceee7b0da Merge 3.6 (issue #28492) 2016-10-20 15:54:51 -04:00
Yury Selivanov a4b884f900 Issue #28492: Fix how StopIteration is raised in _asyncio.Future 2016-10-20 15:54:20 -04:00
Ned Deily ae8ca1c0e2 Issue #24381: merge from 3.6 2016-10-20 15:40:56 -04:00
Ned Deily 82919ec44f Issue #24381: merge from 3.5 2016-10-20 15:40:22 -04:00
Ned Deily f536af1fcd Issue #24381: Avoid unused function warning when building bundled macOS libffi.
Patch by Vajrasky Kok.
2016-10-20 15:38:27 -04:00
Martin Panter 812f6e1f23 Issue #28480: Merge multithreading fixes from 3.6 2016-10-20 05:25:14 +00:00
Martin Panter fa27d5f229 Issue #28480: Avoid label at end of compound statement --without-threads
Based on patch by Masayuki Yamamoto.
2016-10-20 00:48:23 +00:00
Victor Stinner 7a6dbb71b2 _csv: use _PyLong_AsInt() 2016-10-19 16:00:37 +02:00
Yury Selivanov 193a360570 Merge 3.6 (issue #28471) 2016-10-18 16:04:40 -04:00
Yury Selivanov fa22b29960 Issue #28471: Fix crash (GIL state related) in socket.setblocking 2016-10-18 16:03:52 -04:00
Victor Stinner bf9655854b Issue #28256: Cleanup _math.c
Only define fallback implementations when needed. It avoids producing deadcode
when the system provides required math functions.
2016-10-18 16:29:27 +02:00
INADA Naoki 810d62d73e Issue #28452: Remove _asyncio._init_module function 2016-10-18 11:48:35 +09:00
INADA Naoki c411a7d821 Issue #28452: Remove _asyncio._init_module function 2016-10-18 11:48:14 +09:00
INADA Naoki fa8b8847e2 Issue #28428: Rename _futures module to _asyncio. (merge from 3.6)
It will have more speedup functions or classes other than asyncio.Future.
2016-10-15 15:41:05 +09:00
INADA Naoki 9f2ce25481 Issue #28428: Rename _futures module to _asyncio.
It will have more speedup functions or classes other than asyncio.Future.
2016-10-15 15:39:19 +09:00
doko@ubuntu.com 95b826d050 - Modules/Setup.dist: Add the _blake2 module 2016-10-11 08:06:26 +02:00
doko@ubuntu.com 43d3032384 - Modules/Setup.dist: Add the _blake2 module 2016-10-11 08:06:26 +02:00
INADA Naoki 44fa3d3a97 Issue #28405: Fix compile error for _futuresmodule.c on Cygwin.
Patch by Masayuki Yamamoto.
2016-10-11 02:12:52 +09:00
INADA Naoki 1be427bbf1 Issue #28405: Fix compile error for _futuresmodule.c on Cygwin.
Patch by Masayuki Yamamoto.
2016-10-11 02:12:34 +09:00
Martin Panter dd21cc3516 Issue #28394: Merge typo fixes from 3.6 2016-10-10 00:42:50 +00:00
Martin Panter b1321fba53 Issue #28394: More typo fixes for 3.6+ 2016-10-10 00:38:21 +00:00
Serhiy Storchaka 22d60d62e6 Issue #28379: Removed redundant check.
Patch by Xiang Zhang.
2016-10-09 15:37:43 +03:00
INADA Naoki ca2f0d06f1 Issue #26801: Added C implementation of asyncio.Future.
Original patch by Yury Selivanov.
2016-10-09 14:51:36 +09:00
INADA Naoki 9e4e38ecd2 Issue #26801: Added C implementation of asyncio.Future.
Original patch by Yury Selivanov.
2016-10-09 14:44:47 +09:00
Serhiy Storchaka 74a7e3b981 Merge from 3.6. 2016-10-08 22:48:07 +03:00
Serhiy Storchaka 21d9f10c94 Merge from 3.5. 2016-10-08 22:46:01 +03:00
Serhiy Storchaka 9c0e1f83af Issue #28379: Added sanity checks and tests for PyUnicode_CopyCharacters().
Patch by Xiang Zhang.
2016-10-08 22:45:38 +03:00
Steve Dower 9ffb5d7828 Issue #28162: Fixes Ctrl+Z handling in console readall() 2016-10-08 12:37:57 -07:00
Steve Dower c6f9b2b7f5 Issue #28162: Fixes Ctrl+Z handling in console readall() 2016-10-08 12:37:33 -07:00
Serhiy Storchaka f2abc8f2c2 Issue #27998: Fixed bytes path support in os.scandir() on Windows.
Patch by Eryk Sun.
2016-10-08 20:17:26 +03:00
Serhiy Storchaka 2674bc7229 Issue #27998: Fixed bytes path support in os.scandir() on Windows.
Patch by Eryk Sun.
2016-10-08 20:16:57 +03:00
Benjamin Peterson 369d911402 merge 3.6 2016-10-05 23:32:20 -07:00
Benjamin Peterson e4c222c040 merge 3.5 2016-10-05 23:32:15 -07:00
Benjamin Peterson 8f1cdc65ee ensure read size is initialized 2016-10-05 23:32:09 -07:00
Benjamin Peterson 578f1bd578 merge 3.6 2016-10-05 23:29:22 -07:00
Benjamin Peterson 43441c77b5 merge 3.5 2016-10-05 23:29:16 -07:00
Benjamin Peterson 3776836f67 do not leak buffer if mmap is not writable 2016-10-05 23:29:07 -07:00
Benjamin Peterson a1d58efc43 merge 3.6 2016-10-05 22:54:27 -07:00
Benjamin Peterson 87845bcb4d merge 3.5 2016-10-05 22:54:19 -07:00
Benjamin Peterson cd04db03de mmap: do all internal arithmetic with Py_ssize_t while being very careful about overflow 2016-10-05 21:45:48 -07:00
Zachary Ware 99f11b48cd Closes #21124, #28337: Call PyType_Ready on unpackiter_type.
Patch by Masayuki Yamamoto.
2016-10-04 01:20:21 -05:00
Steve Dower 4a8ff9ef60 Issue #28217: Adds _testconsole module to test console input. 2016-10-03 09:12:42 -07:00
Steve Dower 312cef7452 Issue #28217: Adds _testconsole module to test console input. Fixes some issues found by the tests. 2016-10-03 09:04:58 -07:00
Serhiy Storchaka ad72467bef Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().
Original patch by Xiang Zhang.
2016-10-02 21:30:59 +03:00
Serhiy Storchaka b3648576cd Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().
Original patch by Xiang Zhang.
2016-10-02 21:30:35 +03:00
Serhiy Storchaka cc164232aa Issue #28295: Fixed the documentation and added tests for PyUnicode_AsUCS4().
Original patch by Xiang Zhang.
2016-10-02 21:29:26 +03:00
Serhiy Storchaka 6a7d3480fc Issue #28332: Deprecated silent truncations in socket.htons and socket.ntohs.
Original patch by Oren Milman.
2016-10-02 12:34:40 +03:00
Serhiy Storchaka 18c5e8e86f Issue #28322: Fixed possible crashes when unpickle itertools objects from
incorrect pickle data.  Based on patch by John Leitch.
2016-10-02 09:17:08 +03:00
Serhiy Storchaka 8f0f205649 Issue #28322: Fixed possible crashes when unpickle itertools objects from
incorrect pickle data.  Based on patch by John Leitch.
2016-10-02 09:13:14 +03:00
Serhiy Storchaka 85c3f268f4 Issue #28322: Fixed possible crashes when unpickle itertools objects from
incorrect pickle data.  Based on patch by John Leitch.
2016-10-02 08:34:53 +03:00
Zachary Ware 854adb1e01 Issue #21124: Fix building _struct on Cygwin.
Patch by Masayuki Yamamoto.
2016-10-02 00:33:39 -05:00
Zachary Ware 3839d99b79 Issue #13756: Fix building extensions modules on Cygwin
Patch by Roumen Petrov, based on original patch by Jason Tishler.
2016-10-01 16:15:09 -05:00
Zachary Ware 6a6967e827 Issue #21085: add configure check for siginfo_t.si_band
Patch by Masayuki Yamamoto, reviewed and rebased by Erik Bray.

This is a first step on the long road toward resupporting Cygwin, which does
not provide siginfo_t.si_band.
2016-10-01 00:47:27 -05:00
Martin Panter efd1bf4434 Issue #28275: Merge bz2 fix from 3.6 2016-10-01 03:21:22 +00:00
Martin Panter 55c9239af6 Issue #28275: Merge bz2 fix from 3.5 into 3.6 2016-10-01 03:11:04 +00:00
Martin Panter 38317d3318 Issue #28275: Clean up to avoid use-after-free after bzip decompress failure 2016-10-01 02:45:17 +00:00
Victor Stinner 701fb4ba9a Merge 3.6 2016-09-29 22:14:02 +02:00
Victor Stinner 84d8baadbe Fix xml.etree.ElementTree.Element.getiterator()
Issue #28314: Fix function declaration (C flags) for the getiterator() method
of xml.etree.ElementTree.Element.
2016-09-29 22:12:35 +02:00
Alexander Belopolsky 3e7a3cb903 Issue #28148: Stop using localtime() and gmtime() in the time module.
Introduced platform independent _PyTime_localtime API that is similar
to POSIX localtime_r, but available on all platforms.  Patch by Ed
Schouten.
2016-09-28 17:31:35 -04:00
Alexander Belopolsky 9f518cd01a Merged from 3.6 2016-09-28 17:32:31 -04:00
Serhiy Storchaka eeeb3c2531 Issue #20947: Fixed a gcc warning with -Wstrict-overflow. 2016-09-27 22:05:04 +03:00
Serhiy Storchaka 9574e0adf2 Issue #20947: Fixed a gcc warning with -Wstrict-overflow. 2016-09-27 22:04:45 +03:00
Serhiy Storchaka 5ae4f49f4a Issue #20947: Fixed a gcc warning with -Wstrict-overflow. 2016-09-27 22:03:51 +03:00
Serhiy Storchaka be43f2019f Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().
Original patch by John Leitch.
2016-09-27 20:24:19 +03:00
Serhiy Storchaka a12e7842a5 Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().
Original patch by John Leitch.
2016-09-27 20:23:41 +03:00
Serhiy Storchaka c0b7037d4f Issue #28275: Fixed possible use adter free in LZMADecompressor.decompress().
Original patch by John Leitch.
2016-09-27 20:14:26 +03:00
Serhiy Storchaka 9204a20452 Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation()
if pass invalid string-like object as a name.  Patch by Xiang Zhang.
2016-09-27 00:16:25 +03:00
Serhiy Storchaka 22805ca54e Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation()
if pass invalid string-like object as a name.  Patch by Xiang Zhang.
2016-09-27 00:14:24 +03:00
Serhiy Storchaka 407ac47690 Issue #27897: Fixed possible crash in sqlite3.Connection.create_collation()
if pass invalid string-like object as a name.  Patch by Xiang Zhang.
2016-09-27 00:10:03 +03:00
Berker Peksag e2197d1312 Issue #20100: Simplify newPyEpoll_Object()
EPOLL_CLOEXEC is the only value that can be passed
to epoll_create1() and we are passing EPOLL_CLOEXEC
unconditionally since Python 3.4.
2016-09-26 23:30:41 +03:00
Christian Heimes 5a274465a1 Issue #28277: remove linefeed character from iomodule.h. Patch by Michael Felt 2016-09-26 14:08:56 +02:00
Christian Heimes 9df89d06a0 Issue #28277: remove linefeed character from iomodule.h. Patch by Michael Felt 2016-09-26 14:08:47 +02:00
Christian Heimes 04133e7e2e Typo 2016-09-24 12:07:30 +02:00
Christian Heimes 1a63b9f288 Typo 2016-09-24 12:07:21 +02:00
Christian Heimes 7713ef432b Finish GC code for SSLSession and increase test coverage 2016-09-24 10:48:16 +02:00
Christian Heimes a5d0765990 Finish GC code for SSLSession and increase test coverage 2016-09-24 10:48:05 +02:00
Christian Heimes fec8627322 Increase buffer for readlink() in case OS will support longer names one day. 2016-09-23 20:24:45 +02:00
Christian Heimes 6f3f3e5ca4 Increase buffer for readlink() in case OS will support longer names one day. 2016-09-23 20:24:39 +02:00
Christian Heimes 3cb091e576 Increase buffer for readlink() in case OS will support longer names one day. 2016-09-23 20:24:28 +02:00
Christian Heimes 4e8fa31029 Add an extra byte for null in case we ever get very long unicode names. 2016-09-23 20:21:27 +02:00
Christian Heimes 0202c347bc Add an extra byte for null in case we ever get very long unicode names. 2016-09-23 20:21:20 +02:00
Christian Heimes 2f366cab48 Add an extra byte for null in case we ever get very long unicode names. 2016-09-23 20:20:27 +02:00
Christian Heimes d55bdb86ca Don't define PY_WITH_KECCAK 2016-09-21 14:37:04 +02:00
Christian Heimes b00e00c339 Don't define PY_WITH_KECCAK 2016-09-21 14:36:44 +02:00
Victor Stinner b6f3c0dca1 Merge 3.6 (os.getrandom) 2016-09-20 23:01:22 +02:00
Victor Stinner ec2319c46d Fix memleak in os.getrandom()
Issue #27778: Fix a memory leak in os.getrandom() when the getrandom() is
interrupted by a signal and a signal handler raises a Python exception.

Modify also os_getrandom_impl() to avoid the temporary buffer, use directly a
Python bytes object.
2016-09-20 23:00:59 +02:00
Benjamin Peterson b90d15d57e merge 3.6 2016-09-19 22:20:19 -07:00
Benjamin Peterson 8ac46c972f revert expat changes 2016-09-19 22:20:13 -07:00
Benjamin Peterson adaa56ac35 merge 3.6 (closes #28184) 2016-09-19 22:17:44 -07:00
Benjamin Peterson e2e792d98f merge 3.5 (#28184) 2016-09-19 22:17:16 -07:00
Victor Stinner 822675b82e Merge 3.6 2016-09-19 11:56:06 +02:00
Victor Stinner 26c03bd7d5 Fix memory leak in path_converter()
Issue #28200: Replace PyUnicode_AsWideCharString() with
PyUnicode_AsUnicodeAndSize().
2016-09-19 11:55:44 +02:00
Benjamin Peterson 75361243d5 merge 3.6 2016-09-18 18:12:44 -07:00
Benjamin Peterson ac965ca16c stop using Py_LL and Py_ULL 2016-09-18 18:12:21 -07:00
Berker Peksag bf3c1c3235 Issue #28075: Fix test_access_denied in Python 3.5
I forgot there two variations of os.stat() in Python 3.5.
2016-09-18 13:56:29 +03:00
Steve Dower b401d723ac Issue #28161: Opening CON for write access fails
Issue #28162: WindowsConsoleIO readall() fails if first line starts with Ctrl+Z
Issue #28163: WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle
Issue #28164: _PyIO_get_console_type fails for various paths
2016-09-17 13:51:32 -07:00
Steve Dower 27f26ad962 Issue #28161: Opening CON for write access fails
Issue #28162: WindowsConsoleIO readall() fails if first line starts with Ctrl+Z
Issue #28163: WindowsConsoleIO fileno() passes wrong flags to _open_osfhandle
Issue #28164: _PyIO_get_console_type fails for various paths
2016-09-17 13:51:23 -07:00
Steve Dower 64566db065 Merge with 3.6 2016-09-17 12:57:03 -07:00
Steve Dower 313523ce2d Issue #28192: Don't import readline in isolated mode 2016-09-17 12:22:41 -07:00
Berker Peksag 6adb223831 Issue #28075: Merge from 3.6 2016-09-17 15:51:43 +03:00
Berker Peksag 052e4f18c4 Issue #28075: Merge from 3.5 2016-09-17 15:51:14 +03:00
Berker Peksag 0b4dc4846b Issue #28075: Check for ERROR_ACCESS_DENIED in Windows implementation of os.stat()
Patch by Eryk Sun.
2016-09-17 15:49:59 +03:00
Martin Panter 369052bb05 Issue #28139: Merge indentation fixes from 3.6 2016-09-17 07:59:32 +00:00
Martin Panter d508d00919 Issue #28139: Merge indentation fixes from 3.5 into 3.6 2016-09-17 07:59:14 +00:00
Zachary Ware f40d4ddff3 Closes #27979: Remove bundled copy of libffi
An installed copy of libffi is now required for building _ctypes on
any platform but OSX and Windows.
2016-09-17 01:25:24 -05:00
Martin Panter 6d57fe1c23 Issue #28139: Fix messed up indentation
Also update the classmethod and staticmethod doc strings and comments to
match the RST documentation.
2016-09-17 03:26:16 +00:00
Martin Panter 355bbb0a2a Issue #28145: Merge spelling fixes from 3.5 into 3.6 2016-09-16 00:55:27 +00:00
Martin Panter 2dc77f0e19 Issue #28145: Spelling fixes 2016-09-16 00:46:05 +00:00
Berker Peksag 3940499ca8 Issue #28156: Export os.getpid() conditionally
Patch by Ed Schouten.
2016-09-15 20:45:16 +03:00
Berker Peksag 8181646931 Issue #28114: Fix a crash in parse_envlist() when env contains byte strings
Patch by Eryk Sun.
2016-09-15 20:19:47 +03:00
Benjamin Peterson 6775231597 Unicode 9.0.0
Not completely mechanical since support for East Asian Width changes—emoji
codepoints became Wide—had to be added to unicodedata.
2016-09-14 23:53:47 -07:00
Berker Peksag 7ec64562b2 Issue #28153: Make kqueue()'s event filters optional
Patch by Ed Schouten.
2016-09-14 18:16:59 +03:00
Serhiy Storchaka 62a1f024b4 Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). 2016-09-14 16:37:34 +03:00
Serhiy Storchaka e6265e92bf Issue #27599: Fixed buffer overrun in binascii.b2a_qp() and binascii.a2b_qp(). 2016-09-14 16:34:37 +03:00
Christian Heimes 8cee10386e Restrict name_length to NAME_MAXLEN in unicodedata_UCD_lookup() 2016-09-14 10:25:54 +02:00
Christian Heimes 7ce201322e Restrict name_length to NAME_MAXLEN in unicodedata_UCD_lookup() 2016-09-14 10:25:46 +02:00
Benjamin Peterson 37098cd584 more granular configure checks for clock_* functions (closes #28081) 2016-09-13 22:55:09 -07:00
Berker Peksag 8ee9edbf45 Issue #28131: Merge from 3.5 2016-09-14 08:10:45 +03:00
Berker Peksag 4aa74c429c Issue #28131: Fix a regression in zipimport's compile_source()
zipimport should use the same optimization level as the interpreter.
2016-09-14 08:09:48 +03:00
Christian Heimes f6365e3816 Issue #28188: Use PyMem_Calloc() to get rid of a type-limits warning and an extra memset() call in _ssl.c. 2016-09-13 20:48:13 +02: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
Christian Heimes faf2cea1fd Fix NULL check in sock_sendmsg_iovec. CID 1372885 2016-09-13 10:07:16 +02:00
Victor Stinner 410b9887e1 Issue #27866: Fix refleak in cipher_to_dict() 2016-09-12 12:00:23 +02:00
Victor Stinner 52d61e485e socket: Fix memory leak in sendmsg() and sendmsg_afalg()
Issue #27744:

* Release msg.msg_iov memory block.
* Release memory on PyMem_Malloc(controllen) failure
2016-09-12 11:41:58 +02:00
Victor Stinner 288b5bf624 Cleanup socketmodule.c
Issue #27744:

* PEP 7: add {...} around if blocks
* assign variables and then check their value in if() to make the code easier
  to read and to debug.
2016-09-12 11:45:59 +02:00
Raymond Hettinger 88057171f0 Revert part of 3471a3515827 that caused a performance regression 2016-09-11 22:45:53 -07:00
Berker Peksag 59da4b324f Issue #28037: Use sqlite3_get_autocommit() instead of setting Connection->inTransaction manually
Patch adapted from 9b79188edb
2016-09-12 07:16:43 +03:00
Steve Dower 654a7bdf57 Adds missing assert suppression. 2016-09-11 20:19:32 -07:00
Alexander Belopolsky 18f3a9b93c Closes #25283: Make tm_gmtoff and tm_zone available on all platforms. 2016-09-11 22:55:16 -04:00
Christian Heimes 5fe668c672 Issue #28085: Add PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER for SSLContext 2016-09-12 00:01:11 +02:00
Serhiy Storchaka ec406fed16 Issue #27810: Regenerate Argument Clinic. 2016-09-11 21:25:45 +03:00
Eric V. Smith a6d75fdc37 Issue 24454: Removed unused match_getitem_doc. 2016-09-11 10:20:27 -04:00
Eric V. Smith b5690864ba Issue 24454: Added whatsnew entry, removed __getitem__ from match_methods. Thanks Serhiy Storchaka. 2016-09-11 09:50:47 -04:00
Eric V. Smith 605bdae078 Issue 24454: Improve the usability of the re match object named group API 2016-09-11 08:55:43 -04:00
Berker Peksag 9af13ca565 Issue #28036: Remove unused pysqlite_flush_statement_cache function 2016-09-11 15:37:30 +03:00
Serhiy Storchaka 8be17409b7 Use uint16_t instead of short in audioop. 2016-09-11 14:48:16 +03:00
Berker Peksag ab994ed8b9 Issue #10740: sqlite3 no longer implicitly commit an open transaction before DDL statements
This commit contains the following commits from ghaering/pysqlite:

* f254c53494
* 796b3afe38
* cae87ee686
* 3567b31bb5

With the following additions:

* Fixed a refcount error
* Fixed a compiler warning
* Made the string comparison a little more robust
* Added a whatsnew entry
2016-09-11 12:57:15 +03:00
Christian Heimes 99a6570295 Issue #19500: Add client-side SSL session resumption to the ssl module. 2016-09-10 23:44:53 +02:00
Alexander Belopolsky 130bbe5fd3 #28067: Fixed another typo. 2016-09-10 16:51:17 -04:00
Christian Heimes 358cfd426c Issue 28043: SSLContext has improved default settings
The options OP_NO_COMPRESSION, OP_CIPHER_SERVER_PREFERENCE, OP_SINGLE_DH_USE, OP_SINGLE_ECDH_USE, OP_NO_SSLv2 (except for PROTOCOL_SSLv2), and OP_NO_SSLv3 (except for PROTOCOL_SSLv3) are set by default. The initial cipher suite list contains only HIGH ciphers, no NULL ciphers and MD5 ciphers (except for PROTOCOL_SSLv2).
2016-09-10 22:43:48 +02:00
Alexander Belopolsky abd143b23b #28067: Fixed a typo. 2016-09-10 16:08:26 -04:00
Alexander Belopolsky 6d88fa5c05 Closes #28067: Do not call localtime (gmtime) in datetime module. 2016-09-10 15:58:31 -04:00
Nick Coghlan 457fc9a69e Issue #27137: align Python & C implementations of functools.partial
The pure Python fallback implementation of functools.partial
now matches the behaviour of its accelerated C counterpart for
subclassing, pickling and text representation purposes.

Patch by Emanuel Barry and Serhiy Storchaka.
2016-09-10 20:00:02 +10:00
Serhiy Storchaka 8f9cafad3d Issue #28019: itertools.count() no longer rounds non-integer step in range
between 1.0 and 2.0 to 1.
2016-09-10 09:53:51 +03:00
Serhiy Storchaka 8ddcf3abf7 Issue #28019: itertools.count() no longer rounds non-integer step in range
between 1.0 and 2.0 to 1.
2016-09-10 09:49:24 +03:00
Łukasz Langa fef7e94fa1 Don't run garbage collection on interpreter exit if it was explicitly disabled
by the user.
2016-09-09 21:47:46 -07:00
Victor Stinner 37e4ef7b17 Issue #27810: Rerun Argument Clinic on all modules 2016-09-09 20:00:13 -07:00
Benjamin Peterson dec2df3df3 fix dummy macro 2016-09-09 17:46:24 -07:00
Łukasz Langa a785c87d6e DTrace support: function calls, GC activity, line execution
Tested on macOS 10.11 dtrace, Ubuntu 16.04 SystemTap, and libbcc.

Largely based by an initial patch by Jesús Cea Avión, with some
influence from Dave Malcolm's SystemTap patch and Nikhil Benesch's
unification patch.

Things deliberately left out for simplicity:
- ustack helpers, I have no way of testing them at this point since
they are Solaris-specific
- PyFrameObject * in function__entry/function__return, this is
SystemTap-specific
- SPARC support
- dynamic tracing
- sys module dtrace facility introspection

All of those might be added later.
2016-09-09 17:37:37 -07:00
Steve Dower ff70fc2206 Issue #25758: Prevents zipimport from unnecessarily encoding a filename (patch by Eryk Sun) 2016-09-09 17:33:37 -07:00
Steve Dower 8dcc48ee3b Issue #25758: Prevents zipimport from unnecessarily encoding a filename (patch by Eryk Sun) 2016-09-09 17:27:33 -07:00
Brett Cannon a721abac29 Issue #26331: Implement the parsing part of PEP 515.
Thanks to Georg Brandl for the patch.
2016-09-09 14:57:09 -07:00
Benjamin Peterson 7d895ac953 remove --with(out)-signal-module, since the signal module is non-optional 2016-09-09 12:01:10 -07:00
Steve Dower 6230aaf561 Issue #27781: Fixes uninitialized fd when !MS_WINDOWS and !HAVE_OPENAT 2016-09-09 09:03:15 -07:00
Yury Selivanov eb6364557f Issue #28003: Implement PEP 525 -- Asynchronous Generators. 2016-09-08 22:01:51 -07:00
Yury Selivanov f8cb8a16a3 Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.
Patch by Ivan Levkivskyi.
2016-09-08 20:50:03 -07:00
Christian Heimes 0b9d64ebfe Issue 18550: Check return value of ioctl() / fnctl() in internal_setblocking
The function internal_setblocking() of the socket module did not check
the return values of ioctl() and fnctl().

CID 1294328
2016-09-09 00:28:57 +02:00
Christian Heimes ff4fddde57 Add NULL checks to the initializer of the locale module
The _locale module was using old-style APIs to set numeric module
constants from macros. The new way requires less code and properly
checks for NULL.

CID 1295027
2016-09-09 00:24:12 +02:00
Benjamin Peterson bb0b0d9ff0 replace PyInt16 with int16_t 2016-09-08 15:08:02 -07:00
Christian Heimes 7a5457b687 Add error checking to PyInit_pyexpact
The module initializer of the pyexpat module failed to check
the return value of PySys_GetObject() for NULL.

CID 982779
2016-09-09 00:13:35 +02:00
Christian Heimes 6782b14bcb Use PyModule_AddIntMacro() in signal module
The signal module was using old-style module initialization with
potential NULL dereferencing.

CID 1295026
2016-09-09 00:11:45 +02:00
Christian Heimes 275270772e Check return value of PyList_Append() in Py_Main(). CID 1353200 2016-09-09 00:08:35 +02:00
Martin Panter 0be894b2f6 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-09-07 12:03:06 +00:00
Martin Panter be8da9c990 Issue #27570: Avoid zero-length memcpy() calls with null source pointers 2016-09-07 11:04:41 +00:00
Benjamin Peterson 4a757609d1 do not memcpy from NULL 2016-09-06 19:03:40 -07:00
Christian Heimes 1c03abd026 Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 certs. 2016-09-06 23:25:35 +02:00
Benjamin Peterson 1bb0c0bd30 explicitly cast away constness to silence compiler warning 2016-09-05 18:26:19 -07:00
Benjamin Peterson 5130a4d5d7 Backed out changeset 8b6be1341770 2016-09-05 17:22:09 -07:00
Benjamin Peterson 6d999803a0 remove long double from ctypes value union
It is unused. It also forces a 16-byte alignment, which creates problems because
Python's allocator only uses 8-byte alignment.
2016-09-05 16:24:52 -07:00
Christian Heimes 281e5f8839 Issue #26470: Use short name rather than name for compression name to fix #27958. 2016-09-06 01:10:39 +02:00
Benjamin Peterson 768f3b4492 do not pretend to support passing a fd to access() 2016-09-05 15:29:33 -07:00
Christian Heimes 598894ff48 Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. 2016-09-05 23:19:05 +02:00
Serhiy Storchaka 2891492d23 Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level.
Based on patch by Xiang Zhang.
2016-09-01 22:18:03 +03:00
Steve Dower 3929499914 Issue #1602: Windows console doesn't input or print Unicode (PEP 528)
Closes #17602: Adds a readline implementation for the Windows console
2016-08-30 21:22:36 -07:00
Victor Stinner 3b6a6b4215 Add a new private version to the builtin dict type
Issue #26058: Add a new private version to the builtin dict type, incremented
at each dictionary creation and at each dictionary change.

Implementation of the PEP 509.
2016-09-08 12:51:24 -07:00
Benjamin Peterson 207116b84c use Py_MAX 2016-09-08 11:28:06 -07:00
Steve Dower 940f33a50f Issue #23524: Finish removing _PyVerify_fd from sources 2016-09-08 11:21:54 -07:00
Steve Dower 513d7478a1 Fix mismatched if blocks in posixmodule.c. 2016-09-08 10:41:50 -07:00
Steve Dower cc16be85c0 Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529) 2016-09-08 10:35:16 -07:00
Benjamin Peterson cc854499e4 clinic: PY_LONG_LONG -> long long 2016-09-08 09:29:11 -07:00
Benjamin Peterson c235af47f1 fix a PY_LONG_LONG straggler 2016-09-08 09:25:03 -07:00
Benjamin Peterson 47ff0734b8 more PY_LONG_LONG to long long 2016-09-08 09:15:54 -07:00
Christian Heimes c71ec8aef3 sha3: let's keep it simple and always allocate enough extra space for uint64_t[20]. 2016-09-08 15:04:38 +02:00
Christian Heimes 5940c535b0 Issue #26798: Coverity complains about potential memcpy() of overlapped regions. It doesn't hurt to use memmove() here. CID 1372514 / CID 1372515. Upstream https://github.com/BLAKE2/BLAKE2/issues/32 2016-09-08 13:40:25 +02:00
Christian Heimes cf45ee10fb Issue #16113: SHA3: allocate extra memory for lane extraction and check return value of PyModule_Create() 2016-09-08 13:35:00 +02:00
Benjamin Peterson 8f4b247a1d make sure expected values are interpreted as doubles 2016-09-07 18:09:22 -07:00
Martin Panter 1c748f3830 Issue #27570: Merge null pointer fixes from 3.5 2016-09-07 23:31:39 +00:00
Benjamin Peterson 840ef8f84b more linux -> __linux__ 2016-09-07 14:45:10 -07:00
Benjamin Peterson b6c345878a use the '__linux__' instead 'linux' preprocessor define 2016-09-07 14:08:34 -07:00
Brett Cannon 56be5f5376 Eliminate a tautological-pointer-compare warning found by Clang. 2016-09-07 14:07:16 -07:00
Benjamin Peterson a9296e7f3b require C99 bool 2016-09-07 11:06:17 -07:00
Benjamin Peterson 2f8bfef158 replace PY_SIZE_MAX with SIZE_MAX 2016-09-07 09:26:18 -07:00
Christian Heimes eaa3f5f1ee Issue #16113: one more C90 violation in big endian code. 2016-09-07 13:18:40 +02:00
Christian Heimes fa15c854d2 Issue #16113: take 2 on big endian machines. 2016-09-07 13:01:15 +02:00
Christian Heimes b205fe9791 Issue #16113: KeccakP-1600-opt64 does not support big endian platforms yet. 2016-09-07 12:42:47 +02:00
Christian Heimes 6fe2a75b64 Issue #16113: Add SHA-3 and SHAKE support to hashlib module. 2016-09-07 11:58:24 +02:00
Christian Heimes dfb9ef1357 blake2: silence two more warnings on platforms with size_t < uint64_t. Don't use SSE2 when cross-compiling 2016-09-07 11:39:21 +02:00
Steve Dower f5aba58480 Issue #27959: Adds oem encoding, alias ansi to mbcs, move aliasmbcs to codec lookup 2016-09-06 19:42:27 -07:00
Steve Dower a439191efa Fix some warnings from MSVC 2016-09-06 19:09:15 -07:00
Benjamin Peterson 35b40c65f6 merge 3.5 2016-09-06 19:04:37 -07:00
Christian Heimes cc554b65f1 Silence two warnings in blake2. key_length is between 0 and 64 (block size). 2016-09-07 02:49:11 +02:00
Victor Stinner 9f2a920182 Issue #27776: include process.h on Windows for getpid() 2016-09-06 17:03:03 -07:00
Victor Stinner e66987e626 os.urandom() now blocks on Linux
Issue #27776: The os.urandom() function does now block on Linux 3.17 and newer
until the system urandom entropy pool is initialized to increase the security.

This change is part of the PEP 524.
2016-09-06 16:33:52 -07:00
Victor Stinner 9b1f474df6 Add os.getrandom()
Issue #27778: Expose the Linux getrandom() syscall as a new os.getrandom()
function.

This change is part of the PEP 524.
2016-09-06 16:18:52 -07:00
Victor Stinner 581139cb34 Run Argument Clinic on posixmodule.c
Issue #17884.
2016-09-06 15:54:20 -07:00
Christian Heimes dc5a3fe4ef Issue #26798: for loop initial declarations, take 3 2016-09-07 00:32:06 +02:00
Christian Heimes 9c2f304103 Issue #26798: for loop initial declarations, take 2 2016-09-07 00:09:22 +02:00
Christian Heimes fe3c9c1ee9 Issue #27691: Fix ssl module's parsing of GEN_RID subject alternative name fields in X.509 certs. 2016-09-06 23:27:06 +02:00
Christian Heimes 87bf0febcb Issue #26798: for loop initial declarations are only allowed in C99 or C11 mode 2016-09-06 23:18:03 +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
Benjamin Peterson ca47063998 replace Py_(u)intptr_t with the c99 standard types 2016-09-06 13:47:26 -07:00
Benjamin Peterson 9b3d77052f replace Python aliases for standard integer types with the standard integer types (#17884) 2016-09-06 13:24:00 -07:00
Christian Heimes 121b9487d1 Issue #26798: Add BLAKE2 (blake2b and blake2s) to hashlib. 2016-09-06 22:03:25 +02:00
Benjamin Peterson bbeedc261f include (now) int standard headers 2016-09-06 12:41:06 -07:00
Benjamin Peterson ae3869c71e do not need vcstdint.h anymore 2016-09-06 12:07:53 -07:00
Benjamin Peterson 4fe55106d1 require standard int types to be defined (#17884) 2016-09-06 11:58:01 -07:00
Christian Heimes 39093e9e68 Issue #27928: Add scrypt (password-based key derivation function) to hashlib module (requires OpenSSL 1.1.0). 2016-09-06 20:22:28 +02:00
Benjamin Peterson af580dff4a replace PY_LONG_LONG with long long 2016-09-06 10:46:49 -07:00
Victor Stinner 3466bde1cc Avoid calling functions with an empty string as format string
Directly pass NULL rather than an empty string.
2016-09-05 18:16:01 -07: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
Benjamin Peterson 9d1e4a54f7 merge 3.5 2016-09-05 18:26:26 -07:00
Benjamin Peterson ed4aa83ff7 require a long long data type (closes #27961) 2016-09-05 17:44:18 -07:00
Benjamin Peterson f3dd32950b merge 3.5 2016-09-05 17:22:22 -07:00
Benjamin Peterson 63604032af merge 3.5 2016-09-05 16:27:08 -07:00
Christian Heimes 0061bf5892 Issue #26470: Use short name rather than name for compression name to fix #27958. 2016-09-06 01:14:34 +02:00
Benjamin Peterson b1cb8b2872 merge 3.5 2016-09-05 15:35:45 -07:00
Larry Hastings 10108a7b9a Issue #27355: Removed support for Windows CE. It was never finished,
and Windows CE is no longer a relevant platform for Python.
2016-09-05 15:11:23 -07:00
Christian Heimes 8c21ab0ab9 Issue #27744: correct comment and markup 2016-09-06 00:07:02 +02:00
Christian Heimes 25bfcd5d9e Issue #27866: Add SSLContext.get_ciphers() method to get a list of all enabled ciphers. 2016-09-06 00:04:45 +02:00
Christian Heimes dffa3949c7 Issue #27744: Add AF_ALG (Linux Kernel crypto) to socket module. 2016-09-05 23:54:41 +02:00
Christian Heimes 01113faef9 Issue #26470: Port ssl and hashlib module to OpenSSL 1.1.0. 2016-09-05 23:23:24 +02:00
Mark Dickinson 7c4e409d07 Issue #11734: Add support for IEEE 754 half-precision floats to the struct module. Original patch by Eli Stevens. 2016-09-03 17:21:29 +01:00
Serhiy Storchaka af0628e045 Issue #27881: Fixed possible bugs when setting sqlite3.Connection.isolation_level.
Based on patch by Xiang Zhang.
2016-09-01 22:21:05 +03:00
Raymond Hettinger 15f44ab043 Issue #27895: Spelling fixes (Contributed by Ville Skyttä). 2016-08-30 10:47:49 -07:00
Mark Dickinson 84e6311dee Issue 23229: add cmath.inf, cmath.nan, cmath.infj and cmath.nanj. 2016-08-29 13:56:58 +01:00
Serhiy Storchaka 8631da64bb Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory
creates not a cursor.  Patch by Xiang Zhang.
2016-08-29 15:11:52 +03:00
Serhiy Storchaka ef113cd4cc Issue #27861: Fixed a crash in sqlite3.Connection.cursor() when a factory
creates not a cursor.  Patch by Xiang Zhang.
2016-08-29 14:29:55 +03:00
Martin Panter aac9b71632 Issue #19884: Merge Readline updates from 3.5 2016-08-27 04:03:26 +00:00
Martin Panter c427b8d517 Issue #19884: Avoid spurious output on OS X with Gnu Readline
Also adjust the test condition, because enable-meta-key was only added in
6.1, not 6.0.
2016-08-27 03:23:11 +00:00
Brett Cannon 3f9183b5ac Issue #26027, #27524: Add PEP 519/__fspath__() support to os and
os.path.

Thanks to Jelle Zijlstra for the initial patch against posixmodule.c.
2016-08-26 14:44:48 -07:00
Berker Peksag 6ed442c48d Issue #10513: Merge from 3.5 2016-08-26 22:08:51 +03:00
Berker Peksag cc9afa9b51 Issue #10513: Fix a regression in Connection.commit()
Statements should not be reset after a commit.

Backported from 029050896b
2016-08-26 22:07:51 +03: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
R David Murray bdfa0ebff7 #26907: add some missing getsockopt constants.
Patch by Christian Heimes, reviewed by Martin Panter.
2016-08-23 21:12:40 -04:00
Victor Stinner f4d28d4385 Issue #27809: partial_call() uses fast call for positional args 2016-08-23 16:22:35 +02:00
Victor Stinner 7e7823a037 Issue #27809: methodcaller_reduce() uses fast call 2016-08-23 00:23:23 +02:00
Victor Stinner 6412f4993a Issue #27809: _csv: _call_dialect() uses fast call 2016-08-23 00:21:34 +02:00
Victor Stinner d1584d3e7e Issue #27809: tzinfo_reduce() uses fast call 2016-08-23 00:11:04 +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
Berker Peksag d7f3cdd07d Issue #21718: Merge from 3.5 2016-08-21 19:41:38 +03:00
Berker Peksag 6afe85827c Issue #21718: cursor.description is now available for queries using CTEs
According to PEP 249, cursor.description must be
available for any SELECT statements, such as those
that use CTEs.

Backported from f67fa9c898

Additional test cases added by me.
2016-08-21 19:38:47 +03:00
Nick Coghlan cbcd221de4 Merge #27782 fix from 3.5 2016-08-21 17:43:58 +10:00
Nick Coghlan 8682f578c1 Issue #27782: Fix m_methods handling in multiphase init
Multi-phase extension module import now correctly allows the
``m_methods`` field to be used to add module level functions
to instances of non-module types returned from ``Py_create_mod``.

Patch by Xiang Zhang.
2016-08-21 17:41:56 +10:00
Victor Stinner ea5e5990c9 pattern_subx() now uses fast call
Issue #27128.
2016-08-20 01:38:00 +02:00
Victor Stinner 7fbac45287 _elementtree: deepcopy() now uses fast call
Issue #27128.
2016-08-20 01:34:44 +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
Victor Stinner f7a4c488b5 keyobject_richcompare() now uses fast call
Issue #27128: keyobject_richcompare() now calls _PyObject_FastCall() using a
small stack allocated on the C stack to avoid a temporary tuple.
2016-08-19 18:52:35 +02:00
Benjamin Peterson 4d02b1b2bb merge 3.5 (#27783) 2016-08-16 23:37:42 -07:00
Benjamin Peterson 6423429325 merge 3.4 (#27783) 2016-08-16 23:37:33 -07:00
Benjamin Peterson a12d92bec1 merge 3.3 (#27783) 2016-08-16 23:36:20 -07:00
Benjamin Peterson 1f0e7c9933 rearrange methodcaller_new so that the main error case does not cause uninitialized memory usage (closes #27783) 2016-08-16 23:35:35 -07:00
Benjamin Peterson 0a3ccacec7 merge 3.5 (#27774) 2016-08-15 22:05:16 -07:00
Benjamin Peterson 76aa1fb3b1 merge 3.4 (#27774) 2016-08-15 22:05:06 -07:00
Benjamin Peterson 10bc0f6edf merge 3.3 (#27774) 2016-08-15 22:03:44 -07:00
Benjamin Peterson 3a27b0857e do not decref value borrowed from list (closes #27774) 2016-08-15 22:01:41 -07:00
Benjamin Peterson a853c479ee merge 3.5 (#27773) 2016-08-15 21:56:11 -07:00
Benjamin Peterson 81b9ecd2a3 fix corner cases in the management of server_hostname (closes #27773) 2016-08-15 21:55:37 -07:00
Benjamin Peterson cc2e80be64 merge 3.5 2016-08-15 21:44:06 -07:00
Benjamin Peterson b1c6bdc76a merge 3.4 2016-08-15 21:43:57 -07:00
Benjamin Peterson 432ea4ff37 fail when negative values are passed to instr() 2016-08-15 21:40:14 -07:00
Ned Deily eb3be66b3a Issue #27736: Prevent segfault after interpreter re-initialization due
to ref count problem introduced in code for Issue #27038 in 3.6.0a3.
Patch by Xiang Zhang.
2016-08-15 14:40:38 -04:00
Guido van Rossum 0a891d70de Issue #12345: Add mathemathcal constant tau to math and cmath.
Patch by Lisa Roach. See also PEP 628.
2016-08-15 09:12:52 -07:00
Serhiy Storchaka 15f3228b7c Issue #16764: Support keyword arguments to zlib.decompress(). Patch by
Xiang Zhang.
2016-08-15 10:06:16 +03:00
Serhiy Storchaka 9171a8b4ce Issue #27574: Decreased an overhead of parsing keyword arguments in functions
implemented with using Argument Clinic.
2016-08-14 10:52:18 +03:00
Benjamin Peterson b6f78c2755 merge 3.5 (closes #27760) 2016-08-13 18:37:20 -07:00
Benjamin Peterson 91060f26f9 merge 3.4 (closes #27760) 2016-08-13 18:37:12 -07:00
Benjamin Peterson 5295532adb merge 3.3 (closes #27760) 2016-08-13 18:36:55 -07:00
Benjamin Peterson 4f976513ef fix possible integer overflow in binascii.b2a_qp (closes #27760)
Reported by Thomas E. Hybel
2016-08-13 18:33:33 -07:00
Benjamin Peterson c0654d4e60 merge 3.5 2016-08-13 18:21:32 -07:00
Benjamin Peterson f17a8e9acd merge 3.4 2016-08-13 18:21:16 -07:00
Benjamin Peterson 40a77c3381 do not allow reading negative values with getstr() 2016-08-13 18:15:28 -07:00
Benjamin Peterson 7bc44302a0 merge 3.5 (closes #27758) 2016-08-13 17:22:18 -07:00
Benjamin Peterson 9745ee0b44 merge 3.4 (closes #27758) 2016-08-13 17:21:54 -07:00
Benjamin Peterson 59b6abd38c merge 3.3 (#27758) 2016-08-13 17:21:22 -07:00
Benjamin Peterson 6e01d90cc8 check for overflow in join_append_data (closes #27758)
Reported by Thomas E. Hybel
2016-08-13 17:17:06 -07:00
Alexander Belopolsky 47649ab1f1 Closes #27710: Disallow fold not in [0, 1] in time and datetime constructors. 2016-08-08 17:05:40 -04:00
Berker Peksag 95e0df8389 Issue #27702: Only expose SOCK_RAW when defined
SOCK_RAW is marked as optional in the POSIX specification:

    http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html

Patch by Ed Schouten.
2016-08-08 14:07:05 +03:00
Berker Peksag e1d22fda7e Expose EPOLLRDHUP conditionally 2016-08-08 13:39:43 +03:00
Serhiy Storchaka d73c31899e Issue #26800: Undocumented support of general bytes-like objects
as paths in os functions is now deprecated.
2016-08-06 23:22:08 +03:00