summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* bpo-41568: Fix refleaks in zoneinfo subclasses (GH-21907)Miss Islington (bot)2020-08-171-3/+3
| | | | | | | | | | | | | | | | | * Fix refleak in C module __init_subclass__ This was leaking a reference to the weak cache dictionary for every ZoneInfo subclass created. * Fix refleak in ZoneInfo subclass's clear_cache The previous version of the code accidentally cleared the global ZONEINFO_STRONG_CACHE variable (and inducing `ZoneInfo` to create a new strong cache) on calls to a subclass's `clear_cache()`. This would not affect guaranteed behavior, but it's still not the right thing to do (and it caused reference leaks). (cherry picked from commit c3dd7e45cc5d36bbe2295c2840faabb5c75d83e4) Co-authored-by: Paul Ganssle <paul@ganssle.io>
* bpo-40878: xlc cannot handle C99 extern inline. (GH-21891)Miss Islington (bot)2020-08-151-1/+1
| | | | | | | This applies to the default "extc99" mode. Python does not compile with "stdc99". (cherry picked from commit 40e700ad042089120456cc2ee79b8ca69479416b) Authored-by: Stefan Krah <skrah@bytereef.org>
* bpo-31122: ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError ↵Miss Islington (bot)2020-08-151-4/+5
| | | | | | | | | | when peer closes connection during TLS negotiation (GH-18772) [bpo-31122](): ssl.wrap_socket() now raises ssl.SSLEOFError rather than OSError when peer closes connection during TLS negotiation Reproducer: http://tiny.cc/f4ztnz (tiny url because some bot keeps renaming b.p.o.-nnn as bpo links) (cherry picked from commit 495bd035662fda29639f9d52bb6baebea31d72fa) Co-authored-by: Dima Tisnek <dimaqq@gmail.com>
* bpo-41025: Fix subclassing for zoneinfo.ZoneInfo (GH-20965) (GH-21876)Miss Islington (bot)2020-08-141-1/+1
| | | | | | | | | | | Prior to this change, attempting to subclass the C implementation of zoneinfo.ZoneInfo gave the following error: TypeError: unbound method ZoneInfo.__init_subclass__() needs an argument https://bugs.python.org/issue41025 (cherry picked from commit 87d8287865e5c9f137f6b5cf8c34c2c509eb5e9d) Co-authored-by: Paul Ganssle <paul@ganssle.io>
* bpo-41336: Fix the error handling in zoneinfo_new_instance() (GH-21546)Miss Islington (bot)2020-07-201-1/+7
| | | | | | | Do not call PyObject_CallMethod() with a live exception (like KeyboardInterrupt). (cherry picked from commit eca2549f5a5048b44ca88b9555f1c62f094e3c12) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-40150: Fix mismatched argument in RegisterWaitForSingleObject() call ↵Miss Islington (bot)2020-07-151-3/+2
| | | | | | | (GH-19686) (cherry picked from commit af4eda46d1538b1da700a86588bdb94b0a4d1ff2) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* Fix -Wstring-prototypes warnings in _zoneinfo.c. (GH-21478)Miss Islington (bot)2020-07-151-2/+2
| | | | | (cherry picked from commit 0108b2a2401d0ffffe7c07e5ab69a3b0c7593070) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* bpo-41302: Fix build with system libmpdec (GH-21481)Miss Islington (bot)2020-07-152-6/+5
| | | | | | | | | | Move definition of UNUSED from modified headers of libmpdec to _decimal.c itself. This makes the vendored source closer to the standalone library and fixes build with --with-system-libmpdec. Tested to build fine with either system libmpdec or the vendored one. (cherry picked from commit 015efdbef7454a522e88cd79ba2b4cd77a5fb2a2) Co-authored-by: Felix Yan <felixonmars@archlinux.org>
* bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458)Miss Islington (bot)2020-07-131-8/+21
| | | | | | Automerge-Triggered-By: @tiran (cherry picked from commit 4f309abf55f0e6f8950ac13d6ec83c22b8d47bf8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41252: Fix incorrect refcounting in _ssl.c's _servername_callback() ↵Miss Islington (bot)2020-07-091-1/+2
| | | | | | | (GH-21407) (cherry picked from commit ee96f32ca24779656d3c8736d26671fc3689f0a3) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-41247: asyncio.set_running_loop() cache running loop holder (GH-21401)Miss Islington (bot)2020-07-081-3/+9
| | | | | | | | | | | | The running loop holder cache variable was always set to NULL when calling set_running_loop. Now set_running_loop saves the newly created running loop holder in the cache variable for faster access in get_running_loop. Automerge-Triggered-By: @1st1 (cherry picked from commit 529f42645d38b6b0075f256814dfb3d220ac7d92) Co-authored-by: Tony Solomonik <tony.solomonik@gmail.com>
* closes bpo-41235: Fix the error handling in SSLContext.load_dh_params() ↵Miss Islington (bot)2020-07-081-2/+4
| | | | | | | (GH-21385) (cherry picked from commit aebc0495572c5bb85d2bd97d27cf93ab038b5a6a) Co-authored-by: Zackery Spytz <zspytz@gmail.com>
* bpo-29778: Ensure python3.dll is loaded from correct locations when Python ↵Miss Islington (bot)2020-07-061-1/+44
| | | | | | | | | is embedded (GH-21297) Also enables using debug build of `python3_d.dll` Reference: CVE-2020-15523 (cherry picked from commit dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5) Co-authored-by: Steve Dower <steve.dower@python.org>
* Uncomment Py_DEPRECATED for Py_UNICODE APIs (GH-21318)Miss Islington (bot)2020-07-051-4/+4
| | | | | | | | PyUnicode_EncodeDecimal and PyUnicode_TransformDecimalToASCII are deprecated since Python 3.3. But Py_DEPRECATED(3.3) was commented out. (cherry picked from commit 13c90e82b6a1c3baff7f48f1bdc38058f6072f04) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
* bpo-39960: Allow heap types in the "Carlo Verre" hack check that override ↵Miss Islington (bot)2020-07-031-0/+80
| | | | | | | | "tp_setattro()" (GH-21092) Automerge-Triggered-By: @gvanrossum (cherry picked from commit 148f32913573c29250dfb3f0d079eb8847633621) Co-authored-by: scoder <stefan_ml@behnel.de>
* bpo-40967: Remove deprecated asyncio.Task.current_task() and ↵Miss Islington (bot)2020-07-022-170/+1
| | | | | | | asyncio.Task.all_tasks() (GH-20874) (cherry picked from commit 004e64e8059fe68a72890314673282f2e60d5ce1) Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
* bpo-40874 Update the required libmpdec version for the decimal module ↵Miss Islington (bot)2020-06-281-2/+2
| | | | | | | (GH-21202) (cherry picked from commit 8bea91b5e9ea07ca93958e131b436024f0b1b1cf) Authored-by: Stefan Krah <skrah@bytereef.org>
* [3.9] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags ↵Guido van Rossum2020-06-281-1/+3
| | | | (#21022)
* Remove dead code from tracemalloc (GH-21029)Miss Islington (bot)2020-06-271-4/+0
| | | | | | | | tracemalloc_get_frame() checked filename == NULL two times in a row. Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 9cfcdb7d6e4d09bde63bc7116b2ab0d96724527e) Co-authored-by: Christian Heimes <christian@python.org>
* [3.9] bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-18/+18
| | | | | | characters. (GH-21035). (GH-21156) (cherry picked from commit 700cfa8c90a90016638bac13c4efd03786b2b2a0)
* bpo-41094: Additional fix for PYTHONSTARTUP. (GH-21119)Miss Islington (bot)2020-06-241-9/+43
| | | | | (cherry picked from commit a7dc71470156680f1fd5243290c6d377824b7ef4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41094: Fix decoding errors with audit when open files. (GH-21095)Miss Islington (bot)2020-06-242-6/+10
| | | | | (cherry picked from commit 6c6810d98979add7a89391c3c38990d0859f7a29) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.9] bpo-41056: Fix a possible MemoryError leak within zoneinfo. (GH-21007)Paul Ganssle2020-06-241-4/+2
| | | | | | | | This was detected by our Coverity scan as a REVERSE_INULL issue. Automerge-Triggered-By: @gpshead (cherry picked from commit d780fa7) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.9] bpo-31938: Fix default-value signatures of several functions in the ↵Anthony Sottile2020-06-232-13/+17
| | | | | | | select module (GH-21066) (GH-21097) (cherry picked from commit d051801052211b533c46a593b1c1bccf649a171c) Automerge-Triggered-By: @vstinner
* bpo-41085: Fix array.array.index() on 64-bit Windows (GH-21071)Miss Islington (bot)2020-06-231-1/+1
| | | | | | | Fix integer overflow in the :meth:`array.array.index` method on 64-bit Windows for index larger than ``2**31``. (cherry picked from commit 1d3dad5f96ed445b958ec53dfa0d46812f2162d9) Co-authored-by: WildCard65 <WildCard65@users.noreply.github.com>
* bpo-26407: Do not mask errors in csv. (GH-20536)Miss Islington (bot)2020-06-221-8/+8
| | | | | | | | Unexpected errors in calling the __iter__ method are no longer masked by TypeError in csv.reader(), csv.writer.writerow() and csv.writer.writerows(). (cherry picked from commit c88239f864a27f673c0f0a9e62d2488563f9d081) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41061: Fix incorrect expressions in hashtable (GH-21028)Miss Islington (bot)2020-06-221-2/+2
| | | | | | Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 4901ea952691ad70aae21cfe04b6bd363b5a6aff) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-41056: Fix a NULL pointer dereference on MemoryError within the ssl ↵Miss Islington (bot)2020-06-211-6/+6
| | | | | | | | module. (GH-21009) Detected by Coverity. (cherry picked from commit eb0d5c38de7f970d8cd8524f4163d831c7720f51) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.9] bpo-41052: Opt out serialization/deserialization for _random.Random ↵Dong-hee Na2020-06-212-1/+36
| | | | | | | (GH-21002). (GH-21030) (cherry picked from commit 6989af0bc7ea1e9a1acea16794e6f723d7b44110) Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
* 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-061-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>