summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* [3.7] bpo-34922: Fix integer overflow in the digest() and hexdigest() ↵Serhiy Storchaka2018-10-111-1/+4
| | | | | | | methods (GH-9751) (GH-9798) for the SHAKE algorithm in the hashlib module. (cherry picked from commit 9b8c2e767643256202bb11456ba8665593b9a500)
* [3.7] bpo-34906: Doc: Fix typos (2) (GH-9735)Stéphane Wirtel2018-10-101-1/+1
| | | (cherry picked from commit 683281f536981da395575b5a07d6761118259fd2)
* [3.7] Fix a compiler warning added in bpo-34872. (GH-9722). (GH-9726)Serhiy Storchaka2018-10-051-1/+1
| | | | (cherry picked from commit addf8afb43af58b9bf56a0ecfd0f316dd60ac0c3)
* bpo-34906: Doc: Fix typos (GH-9712)Miss Islington (bot)2018-10-051-1/+1
| | | | | (cherry picked from commit 07fbbfde1b300369b4f8d1cfb80045fbb23b7091) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
* [3.7] bpo-34872: Fix self-cancellation in C implementation of asyncio.Task ↵Elvis Pranskevichus2018-10-031-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | (GH-9679) (GH-9691) The C implementation of asyncio.Task currently fails to perform the cancellation cleanup correctly in the following scenario. async def task1(): async def task2(): await task3 # task3 is never cancelled asyncio.current_task().cancel() await asyncio.create_task(task2()) The actuall error is a hardcoded call to `future_cancel()` instead of calling the `cancel()` method of a future-like object. Thanks to Vladimir Matveev for noticing the code discrepancy and to Yury Selivanov for coming up with a pathological scenario.. (cherry picked from commit 548ce9dedd2e90945970671d441436a6a91608ab) Co-authored-by: Elvis Pranskevichus <elvis@magic.io> https://bugs.python.org/issue34872
* Fix incorrect error handling in _pickle.Unpickler.__init__() (GH-9630)Miss Islington (bot)2018-09-291-1/+1
| | | | | | _pickle.Unpickler.__init__() should return -1 if Pdata_New() fails, not 1. (cherry picked from commit 4b430e5f6954ef4b248e95bfb4087635dcdefc6d) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-34736: improve error message for invalid length b64decode inputs (GH-9563)Miss Islington (bot)2018-09-281-3/+7
| | | | | | | | | | Improvements: 1. Include the number of valid data characters in the error message. 2. Mention "number of data characters" rather than "length". https://bugs.python.org/issue34736 (cherry picked from commit 1fba2ffc37da52c08db51fe4360459990b0311c9) Co-authored-by: Tal Einat <taleinat+github@gmail.com>
* [3.7] bpo-34762: Update PyContext* refs to PyObject* in asyncio and decimal ↵Yury Selivanov2018-09-272-12/+11
| | | | (GH-9610)
* bpo-34783: Fix Py_Main() (GH-9526)Victor Stinner2018-09-241-79/+84
| | | | | | | | | | | | | | | Fix a crash with musl libc (on Alpine Linux) when the script filename specified on the command line doesn't exist. pymain_open_filename() now gets the current core configuration from the interpreter state. Modify the code to make it closer to the master branch: * Rename _Py_CommandLineDetails to _PyCmdline * Remove _PyMain.config: replaced with a local variable 'local_config' in pymain_init() * Reorganize pymain_main(): move code using the "local config" into pymain_init() * As soon as possible, switch from the local config to the core configuration attached to the interpreter.
* [3.7] bpo-34670: Add TLS 1.3 post handshake auth (GH-9460) (GH-9505)Christian Heimes2018-09-232-9/+111
| | | | | | | | | | | | | | | | Add SSLContext.post_handshake_auth and SSLSocket.verify_client_post_handshake for TLS 1.3 post-handshake authentication. Signed-off-by: Christian Heimes <christian@python.org>q https://bugs.python.org/issue34670. (cherry picked from commit 9fb051f032c36b9f6086b79086b4d6b7755a3d70) Co-authored-by: Christian Heimes <christian@python.org> https://bugs.python.org/issue34670
* bpo-34759: Fix error handling in ssl 'unwrap()' (GH-9468)Miss Islington (bot)2018-09-221-2/+2
| | | | | | | | | | | | | | | | | OpenSSL follows the convention that whenever you call a function, it returns an error indicator value; and if this value is negative, then you need to go look at the actual error code to see what happened. Commit c6fd1c1c3a introduced a small mistake in _ssl__SSLSocket_shutdown_impl: instead of checking whether the error indicator was negative, it started checking whether the actual error code was negative, and it turns out that the error codes are never negative. So the effect was that 'unwrap()' lost the ability to raise SSL errors. https://bugs.python.org/issue34759 (cherry picked from commit c0da582b227f311126e278b5553a7fa89c79b054) Co-authored-by: Nathaniel J. Smith <njs@pobox.com>
* bpo-34762: Fix contextvars C API to use PyObject* pointer types. (GH-9473)Miss Islington (bot)2018-09-211-1/+1
| | | | | (cherry picked from commit 2ec872b31e25cee1f983fe07991fb53f3fd1cbac) Co-authored-by: Yury Selivanov <yury@magic.io>
* bpo-34735: Fix a memory leak in Modules/timemodule.c (GH-9418)Miss Islington (bot)2018-09-211-0/+1
| | | | | | There was a missing PyMem_Free(format) in time_strftime(). (cherry picked from commit 91e6c8717b7dcbcc46b189509de5f2d335819f37) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* closes bpo-34656: Avoid relying on signed overflow in _pickle memos. (GH-9261)Miss Islington (bot)2018-09-211-31/+31
| | | | | (cherry picked from commit a4ae828ee416a66d8c7bf5ee71d653c2cc6a26dd) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* bpo-34743: Fix test_database_source_name under SQLite 3.7.9 (GH-9426)Miss Islington (bot)2018-09-201-0/+6
| | | | | (cherry picked from commit b10a64d117de6121ea3e79c467c4107f8f399f3d) Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
* bpo-32215: Fix performance regression in sqlite3 (GH-8511)Miss Islington (bot)2018-09-201-4/+4
| | | | | (cherry picked from commit 8d1e190fc507a9e304f6817e761e9f628a23cbd8) Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
* Revert "[3.7] bpo-34589: Add -X coerce_c_locale option; C locale coercion ↵Victor Stinner2018-09-191-124/+35
| | | | | off by default (GH-9379)" (GH-9416) This reverts commit 144f1e2c6f4a24bd288c045986842c65cc289684.
* bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146)Miss Islington (bot)2018-09-182-0/+10
| | | | | | | | | | | The C accelerated _elementtree module now initializes hash randomization salt from _Py_HashSecret instead of libexpat's default CPRNG. Signed-off-by: Christian Heimes <christian@python.org> https://bugs.python.org/issue34623 (cherry picked from commit cb5778f00ce48631c7140f33ba242496aaf7102b) Co-authored-by: Christian Heimes <christian@python.org>
* [3.7] bpo-34589: Add -X coerce_c_locale option; C locale coercion off by ↵Victor Stinner2018-09-181-35/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | default (GH-9379) * bpo-34589: Make _PyCoreConfig.coerce_c_locale private (GH-9371) _PyCoreConfig: * Rename coerce_c_locale to _coerce_c_locale * Rename coerce_c_locale_warn to _coerce_c_locale_warn These fields are now private (name prefixed by "_"). (cherry picked from commit 188ebfa475a6f6aa2d0ea14ca8e1fbe7865b6d27) * bpo-34589: C locale coercion off by default (GH-9073) Py_Initialize() and Py_Main() cannot enable the C locale coercion (PEP 538) anymore: it is always disabled. It can now only be enabled by the Python program ("python3). test_embed: get_filesystem_encoding() doesn't have to set PYTHONUTF8 nor PYTHONCOERCECLOCALE, these variables are already set in the parent. (cherry picked from commit 7a0791b6992d420dc52536257f2f093851ed7215) * bpo-34589: Add -X coerce_c_locale command line option (GH-9378) Add a new -X coerce_c_locale command line option to control C locale coercion (PEP 538). (cherry picked from commit dbdee0073cf0b88fe541980ace1f650900f455cc)
* bpo-32533: Fixed thread-safety of error handling in _ssl. (GH-7158)Miss Islington (bot)2018-09-171-60/+68
| | | | | (cherry picked from commit c6fd1c1c3a65217958b68df3a4991e4f306e9b7d) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
* bpo-34710: fix SSL module build (GH-9347)Miss Islington (bot)2018-09-171-0/+1
| | | | | | | | Include ``openssl/dh.h`` header file to fix implicit function declaration of ``DH_free()``. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com> (cherry picked from commit b3a271fc0ce3e13e427be8914decfc205a220ca8) Co-authored-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* bpo-34603, ctypes/libffi_msvc: Fix returning structs from functions (GH-9258)Miss Islington (bot)2018-09-165-6/+221
| | | | | (cherry picked from commit 7843caeb909bd907e903606414e238db4082315a) Co-authored-by: Vladimir Matveev <v2matveev@outlook.com>
* bpo-34658: Fix rare subprocess prexec_fn fork error. (GH-9255)Miss Islington (bot)2018-09-131-7/+13
| | | | | | | | | | [bpo-34658](https://www.bugs.python.org/issue34658): Fix a rare interpreter unhandled exception state SystemError only seen when using subprocess with a preexec_fn while an after_parent handler has been registered with os.register_at_fork and the fork system call fails. https://bugs.python.org/issue34658 (cherry picked from commit a20b6adb5a5880fd22c099961eb9f9787739cefe) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)Miss Islington (bot)2018-09-121-3/+3
| | | | | | Reported by Svace static analyzer. (cherry picked from commit 6f82bffd2df63a4072b3f0483cdbe93ddedb87e9) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-31577: Fix a crash in os.utime() in case of a bad ns argument. (GH-3752)Miss Islington (bot)2018-09-121-0/+6
| | | | | (cherry picked from commit 0bd1a2dcfdf36b181385ae61361e7692f4ebb0fd) Co-authored-by: Oren Milman <orenmn@gmail.com>
* closes bpo-31903: Release the GIL when calling into SystemConfiguration ↵Miss Islington (bot)2018-09-121-0/+6
| | | | | | | (GH-4178) (cherry picked from commit 4859ba0d2ce4506fddc3f55f90f8dce031b3804f) Co-authored-by: Max Bélanger <aeromax@gmail.com>
* [3.7] closes bpo-25041: Document AF_PACKET socket address format. (GH-9207)Benjamin Peterson2018-09-121-3/+3
| | | | | (cherry picked from commit 731ff68eeef58babdf2b32dc9a73b141760c2be9) Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
* Delete old expat comment. (GH-9197)Miss Islington (bot)2018-09-121-8/+0
| | | | | (cherry picked from commit b9bf9d025e659b5a1963027eb73690e57cb35dd0) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* closes bpo-31608: Fix a crash in methods of a subclass of _collections.deque ↵Miss Islington (bot)2018-09-111-4/+13
| | | | | | | with a bad __new__(). (GH-3788) (cherry picked from commit 24bd50bdcc97d65130c07d6cd26085fd06c3e972) Co-authored-by: Oren Milman <orenmn@gmail.com>
* bpo-34625: Update vendorized expat version to 2.2.6. (GH-9150)Miss Islington (bot)2018-09-114-27/+69
| | | | | (cherry picked from commit 5033aa77aacaa5505636f150e8d54baac5bdca9c) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* bpo-32270: Don't close stdin/out/err in pass_fds (GH-6242) (GH-9148)Miss Islington (bot)2018-09-111-10/+14
| | | | | | | | | | | | | | | | | When subprocess.Popen() stdin= stdout= or stderr= handles are specified and appear in pass_fds=, don't close the original fds after dup'ing them. This implementation and unittest primarily came from @izbyshev (see the PR) See also https://github.com/izbyshev/cpython/commit/b89b52f28490b69142d5c061604b3a3989cec66c This also removes the old manual p2cread, c2pwrite, and errwrite closing logic as inheritable flags and _close_open_fds takes care of that properly today without special treatment. This code is within child_exec() where it is the only thread so there is no race condition between the dup and _Py_set_inheritable_async_safe call. (cherry picked from commit ce34410b8b67f49d8275c05d51b3ead50cf97f48) Co-authored-by: Gregory P. Smith <greg@krypto.org> [Google]
* [3.7] Fix misleading mentions of tp_size in comments. (GH-9136)Benjamin Peterson2018-09-1012-16/+16
| | | | | | | Many type object initializations labeled a field "tp_size" in the comment, but the name of that field is tp_basicsize.. (cherry picked from commit 0e0bc4e221f592f305d335faf5f8046484eb9238) Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
* [3.7] bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() ↵William Grzybowski2018-09-092-2/+2
| | | | | | | | | (GH-9098) (GH-9104) Pass the user/group name as Unicode to the formatting function, instead of always decoding a bytes string from UTF-8.. (cherry picked from commit 28658485a54ad5f9df52ecc12d9046269f1654ec) Co-authored-by: William Grzybowski <wg@FreeBSD.org>
* closes bpo-34581 : Conditionalize use of __pragma in Modules/socketmodule.c. ↵Miss Islington (bot)2018-09-051-2/+5
| | | | | | | (GH-9067) (cherry picked from commit 874809ea389e6434787e773a6054a08e0b81f734) Co-authored-by: Erik Janssens <erik.janssens@conceptive.be>
* bpo-34563: Fix for invalid assert on big output of multiprocessing.Process ↵Miss Islington (bot)2018-09-042-9/+9
| | | | | | | | (GH-9027) (GH-9064) Fix for invalid assert on big output of multiprocessing.Process. (cherry picked from commit 266f4904a222a784080e29aad0916849e507515d) Co-authored-by: Alexander Buchkovsky <olex.buchkovsky@gmail.com>
* closes bpo-34555: Fix incorrectly nested test for HAVE_LINUX_VM_SOCKETS_H ↵Miss Islington (bot)2018-09-011-24/+25
| | | | | | | (GH-9016) (cherry picked from commit 2d7102e726e973ab2d307aa9748c7ec433677877) Co-authored-by: Thomas Herzog <thomas@mcduke.net>
* bpo-34485: Fix _Py_InitializeCore() for C locale coercion (GH-8979) (GH-8981)Victor Stinner2018-08-281-9/+13
| | | | | | | | | | * _Py_InitializeCore() now sets the LC_CTYPE locale to the user preferred locale before checking if the C locale should be coerced or not in _PyCoreConfig_Read(). * Fix pymain_read_conf(): remember if the C locale has been coerced when the configuration should be read again if the encoding has changed. (cherry picked from commit 2c8ddcf4f14f3e4c87a6fe6678ab5ad09130c6ab)
* bpo-34527: POSIX locale enables the UTF-8 Mode (GH-8972) (GH-8974)Victor Stinner2018-08-281-6/+16
| | | | | | | | | | | | * The UTF-8 Mode is now also enabled by the "POSIX" locale, not only by the "C" locale. * On FreeBSD, Py_DecodeLocale() and Py_EncodeLocale() now also forces the ASCII encoding if the LC_CTYPE locale is "POSIX", not only if the LC_CTYPE locale is "C". * test_utf8_mode.test_cmd_line() checks also that the command line arguments are decoded from UTF-8 when the the UTF-8 Mode is enabled with POSIX locale or C locale. (cherry picked from commit 5cb258950ce9b69b1f65646431c464c0c17b1510)
* [3.7] bpo-34492: Modules/main.c: Fix copy_wstrlist() (GH-8910) (GH-8922)Alexey Izbyshev2018-08-251-1/+4
| | | | | | | | * Add missing NULL check reported by Svace static analyzer. * Fix clear_wstrlist() call on a wrong list. (cherry picked from commit eb746dbae8b320758ee08f811316d7f283435cc0) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-13312: Avoid int underflow in time year. (GH-8912)Miss Islington (bot)2018-08-251-0/+6
| | | | | | Avoids an integer underflow in the time module's year handling code. (cherry picked from commit 76be0fffff8b7dbe649ad4821144461800ffb0d0) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* closes bpo-34471: _datetime: Add missing NULL check to ↵Miss Islington (bot)2018-08-241-1/+4
| | | | | | | | tzinfo_from_isoformat_results. (GH-8869) Reported by Svace static analyzer. (cherry picked from commit 498845368ff0f6238750ab1d443e7cf4ec98ccd2) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-34454: fix .fromisoformat() methods crashing on inputs with surrogate ↵Miss Islington (bot)2018-08-231-9/+72
| | | | | | | | | | | | | | | | | | | | | | | code points (GH-8862) The current C implementations **crash** if the input includes a surrogate Unicode code point, which is not possible to encode in UTF-8. Important notes: 1. It is possible to pass a non-UTF-8 string as a separator to the `.isoformat()` methods. 2. The pure-Python `datetime.fromisoformat()` implementation accepts strings with a surrogate as the separator. In `datetime.fromisoformat()`, in the special case of non-UTF-8 separators, this implementation will take a performance hit by making a copy of the input string and replacing the separator with 'T'. Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru> Co-authored-by: Paul Ganssle <paul@ganssle.io> (cherry picked from commit 096329f0b2bf5e3f0a16363aa631d993ce078737) Co-authored-by: Paul Ganssle <pganssle@users.noreply.github.com>
* bpo-34207: Fix pymain_read_conf() for UTF-8 Mode (GH-8868) (GH-8870)Victor Stinner2018-08-231-1/+6
| | | | | | | bpo-34170, bpo-34207: pymain_read_conf() now sets Py_UTF8Mode to config->utf8_mode. pymain_read_conf() calls indirectly Py_DecodeLocale() and Py_EncodeLocale() which depend on Py_UTF8Mode. (cherry picked from commit 89487f51b8d6ba8a55f5de0ed689e46fefe73cc9)
* bpo-34456: pickle: Add missing NULL check to save_global(). (GH-8851)Miss Islington (bot)2018-08-221-0/+2
| | | | | | Reported by Svace static analyzer. (cherry picked from commit f8c06b028036e50596e75d4c9f6b27ba05133efe) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-34441: Fix ABC.__subclasscheck__ crash on classes with invalid ↵Miss Islington (bot)2018-08-201-0/+3
| | | | | | | | __subclasses__ (GH-8835) The missing NULL check was reported by Svace static analyzer. (cherry picked from commit cdbf50cba1664f72ae6621a89c324a32fea70377) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-34217: Use lowercase for windows headers (GH-8472)Miss Islington (bot)2018-08-162-2/+2
| | | | | (cherry picked from commit e6a4755e6793942b950c1595e0c34bd66a0ee13e) Co-authored-by: Erik Janssens <erik.janssens@conceptive.be>
* bpo-34395: Fix memory leaks caused by incautious usage of PyMem_Resize(). ↵Miss Islington (bot)2018-08-162-42/+22
| | | | | | | (GH-8756) (cherry picked from commit 67b9cc8e6072a919d2ed7e7ecc8124c8acfb3733) Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
* [3.7] bpo-34247: Fix Python 3.7 initialization (#8659)Victor Stinner2018-08-051-105/+196
| | | | | | | | | | | | | | | | | * -X dev: it is now possible to override the memory allocator using PYTHONMALLOC even if the developer mode is enabled. * Add _Py_InitializeFromConfig() * Add _Py_Initialize_ReadEnvVars() to set global configuration variables from environment variables * Fix the code to initialize Python: Py_Initialize() now also reads environment variables * _Py_InitializeCore() can now be called twice: the second call only replaces the configuration. * Write unit tests on Py_Initialize() and the different ways to configure Python * The isolated mode now always sets Py_IgnoreEnvironmentFlag and Py_NoUserSiteDirectory to 1. * pymain_read_conf() now saves/restores the configuration if the encoding changed
* Fix docstring of Profiler class (GH-8651)Miss Islington (bot)2018-08-031-2/+2
| | | | | (cherry picked from commit 2ebd3813af9172fe1f9b2f6004edf6f1e1e5d9f1) Co-authored-by: INADA Naoki <methane@users.noreply.github.com>
* bpo-33871: Fix os.sendfile(), os.writev(), os.readv(), etc. (GH-7931)Miss Islington (bot)2018-07-311-17/+20
| | | | | | | | | | | | | | * Fix integer overflow in os.readv(), os.writev(), os.preadv() and os.pwritev() and in os.sendfile() with headers or trailers arguments (on BSD-based OSes and MacOS). * Fix sending the part of the file in os.sendfile() on MacOS. Using the trailers argument could cause sending more bytes from the input file than was specified. Thanks Ned Deily for testing on 32-bit MacOS. (cherry picked from commit 9d5727326af53ddd91016d98e16ae7cf829caa95) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>