summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35062: Fix parsing _io.IncrementalNewlineDecoder's *translate* argument. ↵Miss Islington (bot)2018-10-311-1/+1
| | | | | | | | | (GH-10217) _io.IncrementalNewlineDecoder's initializer possibly assigns out-of-range value to the bitwise struct field. (cherry picked from commit b08746bfdf64e55ce33516f2065fa2aa4f51be95) Co-authored-by: Xiang Zhang <angwerzx@126.com>
* Fix a possible "double decref" in termios.tcgetattr(). (GH-10194)Miss Islington (bot)2018-10-291-2/+2
| | | | | (cherry picked from commit 53835e92d315340444e3dd083b3f69a590b00e07) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35090: Fix potential division by zero in allocator wrappers (GH-10174)Miss Islington (bot)2018-10-283-5/+5
| | | | | | | | | | * Fix potential division by zero in BZ2_Malloc() * Avoid division by zero in PyLzma_Malloc() * Avoid division by zero and integer overflow in PyZlib_Malloc() Reported by Svace static analyzer. (cherry picked from commit 3d4fabb2a424cb04ae446ebe4428090c386f45a5) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* [3.6] bpo-20216: Correct docstrings of digest() methods in hashlib. ↵Serhiy Storchaka2018-10-289-17/+17
| | | | | | | (GH-9873). (GH-10183) (cherry picked from commit f192aeb95a139ede74d69e39c046c498ff288a37) Co-authored-by: Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి) <srinivasreddy@users.noreply.github.com>
* bpo-35059, libmpdec: Add missing EXTINLINE in mpdecimal.h (GH-10128)Miss Islington (bot)2018-10-261-5/+5
| | | | | | | | | | | | | | | | Declare functions with EXTINLINE: * mpd_del() * mpd_uint_zero() * mpd_qresize() * mpd_qresize_zero() * mpd_minalloc() These functions are implemented with "inline" or "ALWAYS_INLINE", but declared without inline which cause linker error on Visual Studio in Debug mode when using /Ob1. (cherry picked from commit 3b1cba3701fd1321a9bdafa9e683f891369f0cfd) Co-authored-by: Victor Stinner <vstinner@redhat.com>
* bpo-34794: Fix a leak in Tkinter. (GH-10025)Miss Islington (bot)2018-10-231-3/+1
| | | | | | Based on the investigation by Xiang Zhang. (cherry picked from commit df13df41a25765d8a39a77220691698498e758d4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Fix error handling bugs in _elementtree.c. (GH-10060)Miss Islington (bot)2018-10-231-11/+11
| | | | | | | References could leak, NULL could be dereferenced, and the Expat parser could be double freed when some errors raised. (cherry picked from commit 9f3ed3e213b30059087d059a7d1d3b2527fa8654) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* closes bpo-35025: Properly guard the `CLOCK_GETTIME` et al macros in ↵Miss Islington (bot)2018-10-211-0/+4
| | | | | | | | timemodule.c. (GH-9961) Guard the `CLOCK_GETTIME` et al macros in `timemodule` based on the availability of the parent functions (cherry picked from commit 94451182ccd6729c11338926d8a3d11645e86626) Co-authored-by: Max Bélanger <aeromax@gmail.com>
* bpo-32890, os: Use errno instead of GetLastError() in execve() and ↵Miss Islington (bot)2018-10-201-3/+15
| | | | | | | | | | | | | truncate() (GH-5784) path_error() uses GetLastError() on Windows, but some os functions are implemented via CRT APIs which report errors via errno. This may result in raising OSError with invalid error code (such as zero). Introduce posix_path_error() function and use it where appropriate. (cherry picked from commit 834603112e6ca35944dd21105b01fca562dc3241) Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
* bpo-34824: Fix a possible NULL pointer dereference in _ssl.c (GH-9606) (GH-9744)Miss Islington (bot)2018-10-191-2/+7
| | | | | | | | | On failure, _PyBytes_Resize() will deallocate the bytes object and set "result" to NULL. https://bugs.python.org/issue34824 (cherry picked from commit 365ad2ead5bbaf7a3b18648ffa36e819559d3f75) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* Elaborate datetime.timedelta docstring (GH-7458)Miss Islington (bot)2018-10-191-1/+5
| | | | | (cherry picked from commit d6a61f232619f8a8e6efacc3da5a02abaf25f090) Co-authored-by: Chris Barker <Chris.Barker@noaa.gov>
* Fix several reference counting bugs in pyexpat.c. (GH-9955)Miss Islington (bot)2018-10-191-4/+8
| | | | | (cherry picked from commit 68def052dcd41313eff2bd9f269e22c5a941db4d) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-35008: Fix possible leaks in Element.__setstate__(). (GH-9924)Miss Islington (bot)2018-10-181-31/+64
| | | | | | | | C implementation of xml.etree.ElementTree.Element.__setstate__() leaked references to children when called for already initialized element. (cherry picked from commit 6f906b3d727d6b341abd5ad9c0652bbcbd5eb024) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.6] bpo-35011: Restore use of pyexpatns.h in libexpat (GH-9939) (GH-9941)Miss Islington (bot)2018-10-181-0/+4
| | | | | | | | | | | | | | | Restores the use of pyexpatns.h to isolate our embedded copy of the expat C library so that its symbols do not conflict at link or dynamic loading time with an embedding application or other extension modules with their own version of libexpat. https://github.com/python/cpython/commit/5dc3f23b5fb0b510926012cb3732dae63cddea60GH-diff-3afaf7274c90ce1b7405f75ad825f545 inadvertently removed it when upgrading expat. (cherry picked from commit 9d4712bc8f26bf1d7e626b53ab092fe030bcd68d) Co-authored-by: Gregory P. Smith <greg@krypto.org> https://bugs.python.org/issue35011
* [3.6] bpo-24658: Fix read/write greater than 2 GiB on macOS (GH-1705) (GH-9937)Stéphane Wirtel2018-10-171-5/+3
| | | | | On macOS, fix reading from and writing into a file with a size larger than 2 GiB. (cherry picked from commit 74a8b6ea7e0a8508b13a1c75ec9b91febd8b5557)
* [3.6] bpo-34941: Fix searching Element subclasses. (GH-9766) (GH-9868)Serhiy Storchaka2018-10-141-12/+13
| | | | | | Methods find(), findtext() and findall() of xml.etree.ElementTree.Element were not able to find chldren which are instances of Element subclasses. (cherry picked from commit b11c5667f99c4f0018e3394c4d07c519d835671a)
* [3.6] bpo-34922: Fix integer overflow in the digest() and hexdigest() ↵Miss Islington (bot)2018-10-111-1/+4
| | | | | | | | | methods (GH-9751) (GH-9798) (GH-9801) for the SHAKE algorithm in the hashlib module. (cherry picked from commit 9b8c2e767643256202bb11456ba8665593b9a500) (cherry picked from commit 8b040e55395b37bdb8fd4ec85a270cfc9ec95307) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.6] bpo-33729: Fix issues with arguments parsing in hashlib. (GH-8346) ↵Serhiy Storchaka2018-10-117-239/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-8581) (GH-9657) * help(hashlib) didn't work because of incorrect module name in blake2b and blake2s classes. * Constructors blake2*(), sha3_*(), shake_*() and keccak_*() incorrectly accepted keyword argument "string" for binary data, but documented as accepting the "data" keyword argument. Now this parameter is positional-only. * Keyword-only parameters in blake2b() and blake2s() were not documented as keyword-only. * Default value for some parameters of blake2b() and blake2s() was None, which is not acceptable value. * The length argument for shake_*.digest() was wrapped out to 32 bits. * The argument for shake_128.digest() and shake_128.hexdigest() was not positional-only as intended. * TypeError messages for incorrect arguments in all constructors sha3_*(), shake_*() and keccak_*() incorrectly referred to sha3_224. Also made the following enhancements: * More accurately specified input and result types for strings, bytes and bytes-like objects. * Unified positional parameter names for update() and constructors. * Improved formatting. (cherry picked from commit f1d36d8efaecd5c84cb35e35119b283f37d83c40) (cherry picked from commit 47957dab94a4efa2fee61c9a8193f78300950769)
* [3.6] bpo-34906: Doc: Fix typos (2) (GH-9735)Stéphane Wirtel2018-10-101-1/+1
| | | (cherry picked from commit 683281f536981da395575b5a07d6761118259fd2)
* Fix a compiler warning added in bpo-34872. (GH-9722). (GH-9726) (GH-9728)Miss Islington (bot)2018-10-051-1/+1
| | | | | (cherry picked from commit addf8afb43af58b9bf56a0ecfd0f316dd60ac0c3) (cherry picked from commit d9212200fe8ddb55d73b8231869cfbb32635ba92)
* [3.6] bpo-34872: Fix self-cancellation in C implementation of asyncio.Task ↵Elvis Pranskevichus2018-10-031-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | (GH-9679) (GH-9690) 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) 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>
* [3.6] bpo-34670: Add TLS 1.3 post handshake auth (GH-9460) (GH-9507)Christian Heimes2018-09-232-8/+109
| | | | | | | | | | | | | | | | 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
* [3.6] bpo-34759: Fix error handling in ssl 'unwrap()' (GH-9468) (GH-9492)Christian Heimes2018-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> https://bugs.python.org/issue34759
* 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-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>
* 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>
* bpo-32533: Fixed thread-safety of error handling in _ssl. (GH-7158)Steve Dower2018-09-171-59/+67
|
* 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-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>
* 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.6] closes bpo-25041: Document AF_PACKET socket address format. (GH-9209)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>
* [3.6] closes bpo-31608: Fix a crash in methods of a subclass of ↵Benjamin Peterson2018-09-111-3/+13
| | | | | | | _collections.deque with a bad __new__(). (GH-9178) (cherry picked from commit 24bd50bdcc97d65130c07d6cd26085fd06c3e972) Co-authored-by: Oren Milman <orenmn@gmail.com>
* bpo-32270: Don't close stdin/out/err in pass_fds (GH-6242) (GH-9149)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]
* bpo-34625: Update vendorized expat version to 2.2.6. (GH-9158)Miss Islington (bot)2018-09-114-27/+69
| | | | | (cherry picked from commit 5033aa77aacaa5505636f150e8d54baac5bdca9c) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* [3.6] Fix misleading mentions of tp_size in comments (GH-9137)Benjamin Peterson2018-09-1010-14/+14
| | | | | | | 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.6] bpo-34604: Fix possible mojibake in pwd.getpwnam() and grp.getgrnam() ↵William Grzybowski2018-09-092-2/+2
| | | | | | | | | (GH-9098) (GH-9105) 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>
* [3.6] bpo-34563: Fix for invalid assert on big output of ↵Alexander Buchkovsky2018-09-072-9/+9
| | | | | | | multiprocessing.Process (GH-9027) (GH-9069) Fix for invalid assert on big output of multiprocessing.Process. (cherry picked from commit 266f4904a222a784080e29aad0916849e507515d)
* 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>
* 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-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>
* bpo-32947: Fixes for TLS 1.3 and OpenSSL 1.1.1 (GH-8761)Christian Heimes2018-08-141-0/+4
| | | | | | | | | | | | | | Backport of TLS 1.3 related fixes from 3.7. Misc fixes and workarounds for compatibility with OpenSSL 1.1.1 from git master and TLS 1.3 support. With OpenSSL 1.1.1, Python negotiates TLS 1.3 by default. Some test cases only apply to TLS 1.2. OpenSSL 1.1.1 has added a new option OP_ENABLE_MIDDLEBOX_COMPAT for TLS 1.3. The feature is enabled by default for maximum compatibility with broken middle boxes. Users should be able to disable the hack and CPython's test suite needs it to verify default options Signed-off-by: Christian Heimes <christian@python.org>
* 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>
* [3.6] bpo-33871: Fix os.sendfile(), os.writev(), os.readv(), etc. (GH-7931) ↵Serhiy Storchaka2018-07-311-16/+17
| | | | | | | | | | | | | | (GH-8584) * Fix integer overflow in os.readv(), os.writev() 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)
* bpo-30237: Output error when ReadConsole is canceled by CancelSynchronousIo. ↵Steve Dower2018-07-291-1/+5
| | | | | (GH-7911) Co-authored-by: ValeriyaSinevich <valeriya.sinevich@phystech.edu>
* [3.6] bpo-29097: Forego fold detection on windows for low timestamp values ↵Ammar Askar2018-07-271-1/+16
| | | | | | | | (GH-2385) (GH-8498) On Windows, passing a negative value to local results in an OSError because localtime_s on Windows does not support negative timestamps. Unfortunately this means that fold detection for timestamps between 0 and max_fold_seconds will result in this OSError since we subtract max_fold_seconds from the timestamp to detect a fold. However, since we know there haven't been any folds in the interval [0, max_fold_seconds) in any timezone, we can hackily just forego fold detection for this time range on Windows.. (cherry picked from commit 96d1e69a12ed8ab80203277e1abdaf573457a964) Co-authored-by: Ammar Askar <ammar_askar@hotmail.com>
* bpo-34068: _io__IOBase_close_impl could call _PyObject_SetAttrId with an ↵Serhiy Storchaka2018-07-171-4/+7
| | | | | | | exception set (GH-8282). (GH-8312) (cherry picked from commit 28f07364f066792ceee93231dbb80ae8ad98b2bb) Co-authored-by: Zackery Spytz <zspytz@gmail.com>