summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* GH-95494: Fix transport EOF handling in OpenSSL 3.0 (GH-95495)David Benjamin2023-03-221-4/+10
| | | | | | | | | | | | | | | | | | | | | GH-25309 enabled SSL_OP_IGNORE_UNEXPECTED_EOF by default, with a comment that it restores OpenSSL 1.1.1 behavior, but this wasn't quite right. That option causes OpenSSL to treat transport EOF as the same as close_notify (i.e. SSL_ERROR_ZERO_RETURN), whereas Python actually has distinct SSLEOFError and SSLZeroReturnError exceptions. (The latter is usually mapped to a zero return from read.) In OpenSSL 1.1.1, the ssl module would raise them for transport EOF and close_notify, respectively. In OpenSSL 3.0, both act like close_notify. Fix this by, instead, just detecting SSL_R_UNEXPECTED_EOF_WHILE_READING and mapping that to the other exception type. There doesn't seem to have been any unit test of this error, so fill in the missing one. This had to be done with the BIO path because it's actually slightly tricky to simulate a transport EOF with Python's fd based APIs. (If you instruct the server to close the socket, it gets confused, probably because the server's SSL object is still referencing the now dead fd?)
* gh-100989: Improve the accuracy of collections.deque docstrings (#100990)Timo Ludwig2023-03-221-13/+24
| | | Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* GH-94808: Cover `PyOS_mystrnicmp` and `PyOS_mystricmp` (gh-102469)Artem Mukhin2023-03-224-1/+65
|
* gh-102839: remove AC for math.log (GH-102863)Sergey B Kirpichev2023-03-212-65/+15
|
* gh-94673: Isolate the _io module to Each Interpreter (gh-102663)Eric Snow2023-03-211-8/+32
| | | | | Aside from sys and builtins, _io is the only core builtin module that hasn't been ported to multi-phase init. We may do so later (e.g. gh-101948), but in the meantime we must at least take care of the module's static types properly. (This came up while working on gh-101660.) https://github.com/python/cpython/issues/94673
* gh-98608: Stop Treating All Errors from _Py_NewInterpreterFromConfig() as ↵Eric Snow2023-03-212-4/+13
| | | | | | | Fatal (gh-102657) Prior to this change, errors in _Py_NewInterpreterFromConfig() were always fatal. Instead, callers should be able to handle such errors and keep going. That's what this change supports. (This was an oversight in the original implementation of _Py_NewInterpreterFromConfig().) Note that the existing [fatal] behavior of the public Py_NewInterpreter() is preserved. https://github.com/python/cpython/issues/98608
* gh-102755: PyErr_DisplayException only in ABI >= 3.12. Tests cover ↵Irit Katriel2023-03-211-3/+13
| | | | PyErr_Display as well (GH-102849)
* gh-102255: Use GetVersionEx instead of GetVersionExW to match argument type ↵Max Bachmann2023-03-201-1/+1
| | | | | | (GH-102583) Since we pass a structure of type `OSVERSIONINFOEX`, we need to call `GetVersionEx` instead of `GetVersionExW`.
* Add more comments to hypot() (GH-102817)Raymond Hettinger2023-03-181-18/+12
|
* Simplify and improve accuracy for subnormals in hypot() (GH-102785)Raymond Hettinger2023-03-171-35/+28
|
* gh-102755: Add PyErr_DisplayException(exc) (#102756)Irit Katriel2023-03-161-10/+3
|
* gh-99726: Improves correctness of stat results for Windows, and uses faster ↵Steve Dower2023-03-161-45/+146
| | | | | API when available (GH-102149) This deprecates `st_ctime` fields on Windows, with the intent to change them to contain the correct value in 3.14. For now, they should keep returning the creation time as they always have.
* gh-102192: remove redundant exception fields from ssl module socket (#102466)Irit Katriel2023-03-162-23/+12
|
* gh-102594: PyErr_SetObject adds note to exception raised on normalization ↵Irit Katriel2023-03-161-0/+21
| | | | error (#102675)
* Simplify and speed-up math.hypot() and math.dist() (GH-102734)Raymond Hettinger2023-03-151-154/+139
|
* gh-102281: Fix potential nullptr dereference + use of uninitialized memory ↵Max Bachmann2023-03-151-1/+4
| | | | (gh-102282)
* gh-102013: Add PyUnstable_GC_VisitObjects (#102014)Jacob Bower2023-03-142-0/+93
|
* gh-101659: Avoid Allocation for Shared Exceptions in the _xxsubinterpreters ↵Eric Snow2023-03-131-74/+49
| | | | | Module (gh-102659) https://github.com/python/cpython/issues/101659
* gh-101524: Fix the ChannelID tp_name (gh-102655)Eric Snow2023-03-131-1/+1
| | | https://github.com/python/cpython/issues/101524
* gh-102650: Remove duplicate include directives from multiple source files ↵chgnrdv2023-03-133-6/+2
| | | | | (#102651) Remove duplicate include directives from multiple source files
* gh-102519: Add os.listdrives, os.listvolumes and os.listmounts on Windows ↵Steve Dower2023-03-102-1/+321
| | | | (GH-102544)
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in ↵Irit Katriel2023-03-102-26/+21
| | | | `_ctypes` (#102477)
* gh-102255: Improve build support for Windows API partitions (GH-102256)Max Bachmann2023-03-0920-83/+176
| | | | | Add `MS_WINDOWS_DESKTOP`, `MS_WINDOWS_APPS`, `MS_WINDOWS_SYSTEM` and `MS_WINDOWS_GAMES` preprocessor definitions to allow switching off functionality missing from particular API partitions ("partitions" are used in Windows to identify overlapping subsets of APIs). CPython only officially supports `MS_WINDOWS_DESKTOP` and `MS_WINDOWS_SYSTEM` (APPS is included by normal desktop builds, but APPS without DESKTOP is not covered). Other configurations are a convenience for people building their own runtimes. `MS_WINDOWS_GAMES` is for the Xbox subset of the Windows API, which is also available on client OS, but is restricted compared to `MS_WINDOWS_DESKTOP`. These restrictions may change over time, as they relate to the build headers rather than the OS support, and so we assume that Xbox builds will use the latest available version of the GDK.
* gh-100227: Isolate the Import State to Each Interpreter (gh-101941)Eric Snow2023-03-091-5/+8
| | | | | | | | | | | | Specific changes: * move the import lock to PyInterpreterState * move the "find_and_load" diagnostic state to PyInterpreterState Note that the import lock exists to keep multiple imports of the same module in the same interpreter (but in different threads) from stomping on each other. Independently, we use a distinct global lock to protect globally shared import state, especially related to loaded extension modules. For now we can rely on the GIL as that lock but with a per-interpreter GIL we'll need a new global lock. The remaining state in _PyRuntimeState.imports will (probably) continue being global. https://github.com/python/cpython/issues/100227
* gh-102304: Consolidate Direct Usage of _Py_RefTotal (gh-102514)Eric Snow2023-03-081-6/+1
| | | | | This simplifies further changes to _Py_RefTotal (e.g. make it atomic or move it to PyInterpreterState). https://github.com/python/cpython/issues/102304
* gh-102507 Remove invisible pagebreak characters (#102531)JosephSBoyle2023-03-081-3/+0
| | | Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
* GH-102397: Fix segfault from race condition in signal handling (#102399)Kumar Aditya2023-03-081-0/+4
| | | Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-102381: don't call watcher callback with dead object (#102382)Carl Meyer2023-03-081-1/+12
| | | Co-authored-by: T. Wouters <thomas@python.org>
* gh-102493: fix normalization in PyErr_SetObject (#102502)Irit Katriel2023-03-071-0/+15
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in ↵Irit Katriel2023-03-061-14/+8
| | | | sub interpreters module (#102472)
* gh-101863: Fix wrong comments in EUC-KR codec (gh-102417)Byeongmin Choi2023-03-041-2/+2
|
* gh-102179: Fix `os.dup2` error reporting for negative fds (#102180)Alexey Izbyshev2023-03-041-5/+0
|
* gh-101101: Fix test_code_extra to reset value for refleak test (gh-102350)Dong-hee Na2023-03-021-1/+5
|
* gh-102336: Ensure CancelIoEx result is not ignored (GH-102347)Max Bachmann2023-03-011-1/+1
| | | fix ignored return value
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives in ↵Irit Katriel2023-03-011-34/+24
| | | | tkinter module (#102319)
* gh-102336: Remove code specifically for handling Windows 7 (GH-102337)Max Bachmann2023-03-015-152/+54
|
* gh-99108: Add missing md5/sha1 defines to Modules/Setup (#102308)Anthony Sottile2023-02-281-2/+2
|
* gh-101101: Unstable C API tier (PEP 689) (GH-101102)Petr Viktorin2023-02-284-1/+120
|
* gh-102251: Updates to test_imp Toward Fixing Some Refleaks (gh-102254)Eric Snow2023-02-271-11/+11
| | | | | | | This is related to fixing the refleaks introduced by commit 096d009. I haven't been able to find the leak yet, but these changes are a consequence of that effort. This includes some cleanup, some tweaks to the existing tests, and a bunch of new test cases. The only change here that might have impact outside the tests in question is in imp.py, where I update imp.load_dynamic() to use spec_from_file_location() instead of creating a ModuleSpec directly. Also note that I've updated the tests to only skip if we're checking for refleaks (regrtest's --huntrleaks), whereas in gh-101969 I had skipped the tests entirely. The tests will be useful for some upcoming work and I'd rather the refleaks not hold that up. (It isn't clear how quickly we'll be able to fix the leaking code, though it will certainly be done in the short term.) https://github.com/python/cpython/issues/102251
* gh-102192: Replace PyErr_Fetch/Restore etc by more efficient alternatives ↵Irit Katriel2023-02-2418-169/+136
| | | | (in Modules/) (#102196)
* gh-101476: Use _PyType_GetModuleState where applicable (#102188)Erlend E. Aasland2023-02-249-15/+19
|
* gh-102141: replace use of getpid on Windows with GetCurrentProcessId (GH-102142)Max Bachmann2023-02-242-7/+12
|
* gh-81652: Add MAP_ALIGNED_SUPER FreeBSD and MAP_CONCEAL OpenBSD constants ↵Yeojin Kim2023-02-241-0/+6
| | | | (gh-102191)
* gh-101476: Add _PyType_GetModuleState (GH-101477)Erlend E. Aasland2023-02-231-1/+2
| | | For fast module state access from heap type methods.
* gh-99108: Followup fix for Modules/Setup (GH-102183)Jonathan Protzenko2023-02-231-2/+2
| | | Automerge-Triggered-By: GH:erlend-aasland
* gh-93649: Split exception tests from _testcapimodule.c (GH-102173)Erlend E. Aasland2023-02-234-288/+282
| | | Automerge-Triggered-By: GH:erlend-aasland
* bpo-23224: Fix segfaults and multiple leaks in the lzma and bz2 modules ↵Zackery Spytz2023-02-234-175/+274
| | | | | | | | | | | | | (GH-7822) lzma.LZMADecompressor and bz2.BZ2Decompressor objects caused segfaults when their `__init__()` methods were not called. lzma.LZMADecompressor, lzma.LZMACompressor, bz2.BZ2Compressor, and bz2.BZ2Decompressor objects would leak locks and internal buffers when their `__init__()` methods were called multiple times. https://bugs.python.org/issue23224
* GH-100719: Remove redundant `gi_code` field from generator object. (GH-100749)Mark Shannon2023-02-231-0/+11
|
* gh-99108: Import MD5 and SHA1 from HACL* (#102089)Jonathan Protzenko2023-02-2218-690/+2471
| | | Replaces our fallback non-OpenSSL MD5 and SHA1 implementations with those from HACL* as we've already done with SHA2.
* Few coverage nitpicks for the cmath module (#102067)Sergey B Kirpichev2023-02-221-2/+2
| | | | | | | | | | | - partial tests for cosh/sinh overflows (L535 and L771). I doubt both ||-ed conditions could be tested. - removed inaccessible case in sqrt (L832): ax=ay=0 is handled above (L823) because fabs() is exact. Also added test (checked with mpmath and gmpy2) for second condition on that line. - some trivial tests for isclose (cover all conditions on L1217-1218) - add comment for uncovered L1018 Co-authored-by: Mark Dickinson <dickinsm@gmail.com>