summaryrefslogtreecommitdiff
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* Add test by Stefan BehnelGuido van Rossum2020-06-211-1/+3
|
* bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)Inada Naoki2020-06-181-0/+10
| | | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> (cherry picked from commit 2c4928d37edc5e4aeec3c0b79fa3460b1ec9b60d)
* bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)Miss Islington (bot)2020-06-152-5/+4
| | | | | | | | | | | | | On Windows, GH-include "pyerrors.h" no longer defines "snprintf" and "vsnprintf" macros. PyOS_snprintf() and PyOS_vsnprintf() should be used to get portable behavior. Replace snprintf() calls with PyOS_snprintf() and replace vsnprintf() calls with PyOS_vsnprintf(). (cherry picked from commit e822e37946f27c09953bb5733acf3b07c2db690f) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40955: Fix memory leak in subprocess module (GH-20825)Miss Islington (bot)2020-06-121-0/+1
| | | | | | | | | | | | | ``` Direct leak of 8 byte(s) in 1 object(s) allocated from: GH-0 0x7f008bf19667 in __interceptor_malloc (/lib64/libasan.so.6+0xb0667) GH-1 0x7f007a0bee4a in subprocess_fork_exec /home/heimes/dev/python/cpython/Modules/_posixsubprocess.c:774 GH-2 0xe0305b in cfunction_call Objects/methodobject.c:546 ``` Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 0d3350daa8123a3e16d4a534b6e873eb12c10d7c) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807) (GH-20813)Victor Stinner2020-06-111-11/+20
| | | | | | | | | | | | Followup of bpo-40854, there is one remaining usage of PLATLIBDIR which should be replaced by config->platlibdir. test_sys checks that sys.platlibdir attribute exists and is a string. Update Makefile: getpath.c and sysmodule.c no longer need PLATLIBDIR macro, PyConfig.platlibdir member is used instead. Co-authored-by: Sandro Mani <manisandro@gmail.com> (cherry picked from commit d72b9644a3e6eec83be48b1ebc2ec6ca776134d3)
* Add multicore support to deccheck.py. (GH-20731) Miss Islington (bot)2020-06-081-21/+110
| | | | | | (cherry picked from commit 951d680d56d8c32556437a86f6b42f221635b97f) Authored-by: Stefan Krah <skrah@bytereef.org>
* bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var ↵Victor Stinner2020-06-081-11/+7
| | | | | | | (GH-20605) (GH-20725) (cherry picked from commit 8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae) Co-authored-by: Sandro Mani <manisandro@gmail.com>
* bpo-40724: Fix return type of test helper function ↵Miss Islington (bot)2020-06-071-1/+1
| | | | | | heapctypewithbuffer_releasebuffer() (GH-20685) (GH-20690) (cherry picked from commit b8867e5d5aca33511942632b5f4e359b9245b2fa) Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
* bpo-40724: Support setting buffer slots from type specs (GH-20648) (GH-20683)Miss Islington (bot)2020-06-071-0/+47
| | | | This is not part of the limited API but makes the buffer slots available for type specs. (cherry picked from commit f7c4e236429606e1c982cacf24e10fc86ef4462f)
* Refactor scripts in Tools/peg_generator/scripts (GH-20401)Miss Islington (bot)2020-06-051-4/+12
| | | | | (cherry picked from commit ba6fd87e41dceb01dcdacc57c722aca12cde42a9) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40874: Update to libmpdec-2.5.0 (GH-20652)Miss Islington (bot)2020-06-0538-296/+502
| | | | | (cherry picked from commit 087d612efebe7c64e5f079b07e0454111859830e) Authored-by: Stefan Krah <skrah@bytereef.org>
* bpo-40865: Remove unused insint() macro from hash modules (GH-20627)Miss Islington (bot)2020-06-044-12/+0
| | | | | | Automerge-Triggered-By: @tiran (cherry picked from commit 6ed578f6dbffdec94f62cc2e36d626fc195678d7) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* [3.9] bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578) (GH-20618)Victor Stinner2020-06-031-1/+1
| | | | | | | | | | | | | | | * bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571) Add _Py_EnsureTstateNotNULL(tstate) macro: call Py_FatalError() if tstate is NULL, the error message contains the current function name. (cherry picked from commit 3026cad59b87751a9215111776cac8e819458fce) * bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578) PyOS_InterruptOccurred() now fails with a fatal error if it is called with the GIL released. (cherry picked from commit cbe129692293251e7fbcea9ff0d822824d90c140)
* [3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613)Victor Stinner2020-06-031-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | * bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20579) Fix GIL usage in PyOS_Readline(): lock the GIL to set an exception. Pass tstate to my_fgets() and _PyOS_WindowsConsoleReadline(). Cleanup these functions. (cherry picked from commit c353764fd564e401cf47a5d9efab18c72c60014e) * bpo-40826: Add _PyOS_InterruptOccurred(tstate) function (GH-20599) my_fgets() now calls _PyOS_InterruptOccurred(tstate) to check for pending signals, rather calling PyOS_InterruptOccurred(). my_fgets() is called with the GIL released, whereas PyOS_InterruptOccurred() must be called with the GIL held. test_repl: use text=True and avoid SuppressCrashReport in test_multiline_string_parsing(). Fix my_fgets() on Windows: fgets(fp) does crash if fileno(fp) is closed. (cherry picked from commit fa7ab6aa0f9a4f695e5525db5a113cd21fa93787)
* [3.9] bpo-40630: Add tracemalloc.reset_peak (GH-20102) (GH-20545)Huon Wilson2020-06-012-1/+46
| | | | | | | | | | | * bpo-40630: Add tracemalloc.reset_peak (GH-20102, cherrypick 8b62644) The reset_peak function sets the peak memory size to the current size, representing a resetting of that metric. This allows for recording the peak of specific sections of code, ignoring other code that may have had a higher peak (since the most recent `tracemalloc.start()` or tracemalloc.clear_traces()` call). * Adjust docs to point to 3.9
* bpo-30008: Fix OpenSSL no-deprecated compilation (GH-20397)Miss Islington (bot)2020-06-011-11/+45
| | | | | | | | | | | | Fix :mod:`ssl`` code to be compatible with OpenSSL 1.1.x builds that use ``no-deprecated`` and ``--api=1.1.0``. Note: Tests assume full OpenSSL API and fail with limited API. Signed-off-by: Christian Heimes <christian@python.org> Co-authored-by: Mark Wright <gienah@gentoo.org> (cherry picked from commit a871f692b4a2e6c7d45579693e787edc0af1a02c) Co-authored-by: Christian Heimes <christian@python.org>
* [3.9] bpo-40777: Initialize PyDateTime_IsoCalendarDateType.tp_base at ↵Miss Islington (bot)2020-05-281-3/+10
| | | | | | | | | | | run-time (GH-20493) (GH-20495) Recent changes to _datetimemodule broke compilation on mingw; see the comments in this change for details. FWIW, @corona10: this issue is why `PyType_FromModuleAndSpec` & friends take the `bases` argument at run time. (cherry picked from commit 459acc551656785bc4a3363d65c7a60f822da8e3) Co-authored-by: Petr Viktorin <encukou@gmail.com>
* bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for ↵Miss Islington (bot)2020-05-285-0/+6
| | | | | | | | | | | | PyType_FromSpec types (reverts GH-19414) (GH-20264) Heap types now always visit the type in tp_traverse. See added docs for details. This reverts commit 0169d3003be3d072751dd14a5c84748ab63a249f. Automerge-Triggered-By: @encukou (cherry picked from commit 1cf15af9a6f28750f37b08c028ada31d38e818dd) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.9] bpo-40791: Use CRYPTO_memcmp() for compare_digest (GH-20456) (GH-20461)Christian Heimes2020-05-283-1/+159
| | | | | | | | | | | hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function when OpenSSL is available. Note: The _operator module is a builtin module. I don't want to add libcrypto dependency to libpython. Therefore I duplicated the wrapper function and added a copy to _hashopenssl.c.. (cherry picked from commit db5aed931f8a617f7b63e773f62db468fe9c5ca1) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)Miss Islington (bot)2020-05-272-14/+31
| | | | | | | | | If ctypes fails to convert the result of a callback or if a ctypes callback function raises an exception, sys.unraisablehook is now called with an exception set. Previously, the error was logged into stderr by PyErr_Print(). (cherry picked from commit 10228bad0452d94e66c964b625a0b61befa08e59) Co-authored-by: Victor Stinner <vstinner@python.org>
* Fix compiler warnings in _zoneinfo.c (GH-20342)Miss Islington (bot)2020-05-271-30/+26
| | | | | | | | | | ``` D:\a\cpython\cpython\Modules\_zoneinfo.c(903,52): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj] D:\a\cpython\cpython\Modules\_zoneinfo.c(904,44): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj] D:\a\cpython\cpython\Modules\_zoneinfo.c(1772,31): warning C4244: '=': conversion from 'ssize_t' to 'uint8_t', possible loss of data [D:\a\cpython\cpython\PCbuild\_zoneinfo.vcxproj] ``` (cherry picked from commit e4799b95945b44eb0e2eea26473db8e0a49ed0ee) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)Miss Islington (bot)2020-05-271-0/+15
| | | | | | | | | | | | | ctypes now raises an ArgumentError when a callback is invoked with more than 1024 arguments. The ctypes module allocates arguments on the stack in ctypes_callproc() using alloca(), which is problematic when large numbers of arguments are passed. Instead of a stack overflow, this commit raises an ArgumentError if more than 1024 parameters are passed. (cherry picked from commit 29a1384c040d39659e7d01f1fd7b6eb71ef2634e) Co-authored-by: Sean Gillespie <sean@swgillespie.me>
* bpo-38580: Document that select() accepts iterables, not just sequences ↵Miss Islington (bot)2020-05-262-5/+5
| | | | | | | (GH-16832) (cherry picked from commit 372ee27d4958302dac7ad6a8711f6fd04771b2e6) Co-authored-by: Jakub Stasiak <jakub@stasiak.at>
* bpo-40737: Fix possible reference leak for sqlite3 initialization (GH-20323)Miss Islington (bot)2020-05-261-8/+12
| | | | | (cherry picked from commit 5eb45d7d4e812e89d77da84cc619e9db81561a34) Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
* bpo-35714: Reject null characters in struct format strings (GH-16928)Miss Islington (bot)2020-05-261-0/+5
| | | | | | | struct.error is now raised if there is a null character in a struct format string. (cherry picked from commit 3f59b55316f4c6ab451997902579aa69020b537c) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-40688: Use the correct parser in the peg_generator scripts (GH-20235)Miss Islington (bot)2020-05-251-52/+81
| | | | | | | | | | The scripts in `Tools/peg_generator/scripts` mostly assume that `ast.parse` and `compile` use the old parser, since this was the state of things, while we were developing them. They need to be updated to always use the correct parser. `_peg_parser` is being extended to support both parsing and compiling with both parsers. (cherry picked from commit 9645930b5bc1833ef495891d22052d1ba65ab7ea) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40671: Prepare _hashlib for PEP 489 (GH-20180)Miss Islington (bot)2020-05-251-67/+114
| | | | | (cherry picked from commit 20c22db602bf2a51f5231433b9054290f8069b90) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-40705: Fix use-after-free in _zoneinfo's module_free (GH-20280)Miss Islington (bot)2020-05-241-6/+9
| | | | | (cherry picked from commit 06a1b8915d6674e40f0dccc422ca2c06212392d8) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
* bpo-40696: Fix a hang that can arise after gen.throw() (GH-20287)Miss Islington (bot)2020-05-221-6/+6
| | | | | | | | | | This updates _PyErr_ChainStackItem() to use _PyErr_SetObject() instead of _PyErr_ChainExceptions(). This prevents a hang in certain circumstances because _PyErr_SetObject() performs checks to prevent cycles in the exception context chain while _PyErr_ChainExceptions() doesn't. (cherry picked from commit 7c30d12bd5359b0f66c4fbc98aa055398bcc8a7e) Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
* [3.9] bpo-40714: Remove compile warning from _zoneinfo.c (GH-20291) (GH-20293)Miss Islington (bot)2020-05-211-2/+4
| | | | | | | | (cherry picked from commit a487a39dca4c41305928c7dfdbcb0b3aa344683b) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com> Automerge-Triggered-By: @corona10
* bpo-40645: restrict HMAC key len to INT_MAX (GH-20238)Miss Islington (bot)2020-05-191-1/+7
| | | | | | | | Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: @tiran (cherry picked from commit aca4670ad695d4b01c7880fe3d0af817421945bd) Co-authored-by: Christian Heimes <christian@python.org>
* [3.9] bpo-40514: Remove --with-experimental-isolated-subinterpreters in 3.9 ↵Victor Stinner2020-05-202-23/+0
| | | | | | | (GH-20228) Remove --with-experimental-isolated-subinterpreters configure option in Python 3.9: the experiment continues in the master branch, but it's no longer needed in 3.9.
* bpo-40677: Define IO_REPARSE_TAG_APPEXECLINK explicitly (GH-20206)Miss Islington (bot)2020-05-191-0/+4
| | | | | | This allows building with older versions of the Windows SDK where the value is not defined. (cherry picked from commit 711f9e180a48baba62301735b7f1a58ef0d0e93a) Co-authored-by: Minmin Gong <gongminmin@msn.com>
* bpo-40653: Move _dirnameW out of #ifdef HAVE_SYMLINK/#endif (GH-20144)Minmin Gong2020-05-181-2/+6
|
* bpo-39148: enable ipv6 for datagrams in Proactor (GH-19121)Kjell Braden2020-05-171-5/+2
| | | | | | Ifdef is not necessary, as AF_INET6 is supported from Windows Vista, and other code in overlapped.c uses AF_INET6 and is not ifdef'd. Change the raised exception so users are not fooled to think it comes from Windows API. Automerge-Triggered-By: @njsmith
* bpo-31033: Improve the traceback for cancelled asyncio tasks (GH-19951)Chris Jerdonek2020-05-172-22/+106
| | | | | When an asyncio.Task is cancelled, the exception traceback now starts with where the task was first interrupted. Previously, the traceback only had "depth one."
* bpo-40665: Use Argument Clinic for the bisect module (GH-20163)Shantanu2020-05-172-131/+411
|
* bpo-37630: Fix spelling shake128 -> shake_128 (GH-20154)Christian Heimes2020-05-172-39/+39
|
* bpo-40645: Implement HMAC in C (GH-20129)Christian Heimes2020-05-172-17/+568
| | | | | | | | | The internal module ``_hashlib`` wraps and exposes OpenSSL's HMAC API. The new code will be used in Python 3.10 after the internal implementation details of the pure Python HMAC module are no longer part of the public API. The code is based on a patch by Petr Viktorin for RHEL and Python 3.6. Co-Authored-By: Petr Viktorin <encukou@gmail.com>
* bpo-39740: Early declare devpoll_methods to support old compilers (GH-19281)Batuhan Taskaya2020-05-161-0/+2
|
* bpo-37630: Use SHA3 and SHAKE XOF from OpenSSL (GH-16049)Christian Heimes2020-05-162-18/+822
| | | | | | | OpenSSL 1.1.1 comes with SHA3 and SHAKE builtin. Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: @tiran
* bpo-24416: Return named tuple from date.isocalendar() (GH-20113)Paul Ganssle2020-05-162-5/+203
| | | | | | | | | | | | | | | | | | | | | | | {date, datetime}.isocalendar() now return a private custom named tuple object IsoCalendarDate rather than a simple tuple. In order to leave IsocalendarDate as a private class and to improve what backwards compatibility is offered for pickling the result of a datetime.isocalendar() call, add a __reduce__ method to the named tuples that reduces them to plain tuples. (This is the part of this PR most likely to cause problems — if it causes major issues, switching to a strucseq or equivalent would be prudent). The pure python implementation of IsoCalendarDate uses positional-only arguments, since it is private and only constructed by position anyway; the equivalent change in the argument clinic on the C side would require us to move the forward declaration of the type above the clinic import for whatever reason, so it seems preferable to hold off on that for now. bpo-24416: https://bugs.python.org/issue24416 Original PR by Dong-hee Na with only minor alterations by Paul Ganssle. Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* bpo-40192: Use thread_cputime for time.thread_time to improve resolution ↵Batuhan Taskaya2020-05-161-0/+28
| | | | | | | (GH-19381) On AIX, time.thread_time() is now implemented with thread_cputime() which has nanosecond resolution, rather than clock_gettime(CLOCK_THREAD_CPUTIME_ID) which has a resolution of 10 ms.
* bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909)Paul Ganssle2020-05-162-0/+2696
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the initial implementation of PEP 615, the zoneinfo module, ported from the standalone reference implementation (see https://www.python.org/dev/peps/pep-0615/#reference-implementation for a link, which has a more detailed commit history). This includes (hopefully) all functional elements described in the PEP, but documentation is found in a separate PR. This includes: 1. A pure python implementation of the ZoneInfo class 2. A C accelerated implementation of the ZoneInfo class 3. Tests with 100% branch coverage for the Python code (though C code coverage is less than 100%). 4. A compile-time configuration option on Linux (though not on Windows) Differences from the reference implementation: - The module is arranged slightly differently: the accelerated module is `_zoneinfo` rather than `zoneinfo._czoneinfo`, which also necessitates some changes in the test support function. (Suggested by Victor Stinner and Steve Dower.) - The tests are arranged slightly differently and do not include the property tests. The tests live at test/test_zoneinfo/test_zoneinfo.py rather than test/test_zoneinfo.py or test/test_zoneinfo/__init__.py because we may do some refactoring in the future that would likely require this separation anyway; we may: - include the property tests - automatically run all the tests against both pure Python and C, rather than manually constructing C and Python test classes (similar to the way this works with test_datetime.py, which generates C and Python test cases from datetimetester.py). - This includes a compile-time configuration option on Linux (though not on Windows); added with much help from Thomas Wouters. - Integration into the CPython build system is obviously different from building a standalone zoneinfo module wheel. - This includes configuration to install the tzdata package as part of CI, though only on the coverage jobs. Introducing a PyPI dependency as part of the CI build was controversial, and this is seen as less of a major change, since the coverage jobs already depend on pip and PyPI. Additional changes that were introduced as part of this PR, most / all of which were backported to the reference implementation: - Fixed reference and memory leaks With much debugging help from Pablo Galindo - Added smoke tests ensuring that the C and Python modules are built The import machinery can be somewhat fragile, and the "seamlessly falls back to pure Python" nature of this module makes it so that a problem building the C extension or a failure to import the pure Python version might easily go unnoticed. - Adjustments to zoneinfo.__dir__ Suggested by Petr Viktorin. - Slight refactorings as suggested by Steve Dower. - Removed unnecessary if check on std_abbr Discovered this because of a missing line in branch coverage.
* bpo-40457: Support OpenSSL without TLS 1.0/1.1 (GH-19862)Christian Heimes2020-05-151-34/+27
| | | | | | | | | | | OpenSSL can be build without support for TLS 1.0 and 1.1. The ssl module now correctly adheres to OPENSSL_NO_TLS1 and OPENSSL_NO_TLS1_1 flags. Also update multissltest to test with latest OpenSSL and LibreSSL releases. Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: @tiran
* bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979)Chris Jerdonek2020-05-152-27/+148
|
* bpo-40515: Require OPENSSL_THREADS (GH-19953)Christian Heimes2020-05-152-1/+9
| | | | | | | The ``ssl`` and ``hashlib`` modules now actively check that OpenSSL is build with thread support. Python 3.7.0 made thread support mandatory and no longer works safely with a no-thread builds. Signed-off-by: Christian Heimes <christian@python.org>
* bpo-40479: Fix hashlib issue with OpenSSL 3.0.0 (GH-20107)Christian Heimes2020-05-152-8/+17
| | | | | | | | | | OpenSSL 3.0.0-alpha2 was released today. The FIPS_mode() function has been deprecated and removed. It no longer makes sense with the new provider and context system in OpenSSL 3.0.0. EVP_default_properties_is_fips_enabled() is good enough for our needs in unit tests. It's an internal API, too. Signed-off-by: Christian Heimes <christian@python.org>
* Trivial typo fix in _tkinter.c (GH-19622)Andrew York2020-05-151-7/+7
| | | Change spelling of a #define in _tkinter.c from HAVE_LIBTOMMAMTH to HAVE_LIBTOMMATH, since this is used to keep track of tclTomMath.h, not tclTomMamth.h. No other file seems to refer to this variable.
* bpo-40602: _Py_hashtable_set() reports rehash failure (GH-20077)Victor Stinner2020-05-141-5/+9
| | | | If _Py_hashtable_set() fails to grow the hash table (rehash), it now fails rather than ignoring the error.