summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* gh-101965: Fix usage of Py_EnterRecursiveCall return value in ↵Owain Davies2023-02-211-2/+2
| | | | | | | _bisectmodule.c (GH-101966) Closes #101965 Automerge-Triggered-By: GH:erlend-aasland
* gh-101819: Adapt _io types to heap types, batch 1 (GH-101949)Erlend E. Aasland2023-02-208-469/+373
| | | | | Adapt StringIO, TextIOWrapper, FileIO, Buffered*, and BytesIO types. Automerge-Triggered-By: GH:erlend-aasland
* Add missing 'is' to `cmath.log()` docstring (#102049)Owain Davies2023-02-192-4/+4
| | | Fix missing 'is' in cmath.log() docstring
* gh-101881: Support (non-)blocking read/write functions on Windows pipes ↵Rayyan Ansari2023-02-162-19/+1
| | | | | | | | | | | | (GH-101882) * fileutils: handle non-blocking pipe IO on Windows Handle erroring operations on non-blocking pipes by reading the _doserrno code. Limit writes on non-blocking pipes that are too large. * Support blocking functions on Windows Use the GetNamedPipeHandleState and SetNamedPipeHandleState Win32 API functions to add support for os.get_blocking and os.set_blocking.
* gh-99108: Refactor _sha256 & _sha512 into _sha2. (#101924)Gregory P. Smith2023-02-168-1375/+1247
| | | | | | | | | This merges their code. They're backed by the same single HACL* static library, having them be a single module simplifies maintenance. This should unbreak the wasm enscripten builds that currently fail due to linking in --whole-archive mode and the HACL* library appearing twice. Long unnoticed error fixed: _sha512.SHA384Type was doubly assigned and was actually SHA512Type. Nobody depends on those internal names. Also rename LIBHACL_ make vars to LIBHACL_SHA2_ in preperation for other future HACL things.
* gh-98627: Add an Optional Check for Extension Module Subinterpreter ↵Eric Snow2023-02-161-2/+10
| | | | | | | | | | | | | | | Compatibility (gh-99040) Enforcing (optionally) the restriction set by PEP 489 makes sense. Furthermore, this sets the stage for a potential restriction related to a per-interpreter GIL. This change includes the following: * add tests for extension module subinterpreter compatibility * add _PyInterpreterConfig.check_multi_interp_extensions * add Py_RTFLAGS_MULTI_INTERP_EXTENSIONS * add _PyImport_CheckSubinterpIncompatibleExtensionAllowed() * fail iff the module does not implement multi-phase init and the current interpreter is configured to check https://github.com/python/cpython/issues/98627
* gh-101758: Add a Test For Single-Phase Init Modules in Multiple Interpreters ↵Eric Snow2023-02-152-2/+62
| | | | | | | (gh-101920) The test verifies the behavior of single-phase init modules when loaded in multiple interpreters. https://github.com/python/cpython/issues/101758
* gh-99138: Isolate _zoneinfo (#99218)Erlend E. Aasland2023-02-152-198/+536
| | | | * Convert zone info type to heap type and add it to module state * Add global variables to module state
* gh-101819: Remove _PyWindowsConsoleIO_Type from the Windows DLL (GH-101904)Erlend E. Aasland2023-02-152-7/+1
| | | Automerge-Triggered-By: GH:erlend-aasland
* gh-101819: Remove _testcapi dependencies on specific _io symbols (#101918)Erlend E. Aasland2023-02-152-12/+8
|
* gh-101693: In sqlite3, deprecate using named placeholders with parameters ↵Erlend E. Aasland2023-02-151-0/+13
| | | | supplied as a sequence (#101698)
* gh-99108: Build the hashlib HACL* code as a static library. (#101917)Gregory P. Smith2023-02-142-2/+3
| | | | | | This builds HACL* as a library in one place. A followup to #101707 which broke some WASM builds. This fixes 2/4 of them, but the enscripten toolchain in the others don't deduplicate linker arguments and error out. A follow-on PR will address those.
* gh-101758: Add a Test For Single-Phase Init Module Variants (gh-101891)Eric Snow2023-02-141-28/+366
| | | | | The new test exercises the most important variants for single-phase init extension modules. We also add some explanation about those variants to import.c. https://github.com/python/cpython/issues/101758
* gh-99108: Import SHA2-384/512 from HACL* (#101707)Jonathan Protzenko2023-02-1412-431/+1250
| | | | | | Replace the builtin hashlib implementations of SHA2-384 and SHA2-512 originally from LibTomCrypt with formally verified, side-channel resistant code from the [HACL*](https://github.com/hacl-star/hacl-star/) project. The builtins remain a fallback only used when OpenSSL does not provide them.
* gh-101857: Allow xattr detection on musl libc (#101858)Sam James2023-02-141-1/+2
| | | | | | | | | | Previously, we checked exclusively for `__GLIBC__` (AND'd with some other conditions). Checking for `__linux__` instead should be fine. This fixes using e.g. `os.listxattr()` on systems using musl libc. Bug: https://bugs.gentoo.org/894130 Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-74895: getaddrinfo no longer raises OverflowError (#2435)Radek Smejkal2023-02-142-6/+14
| | | `socket.getaddrinfo()` no longer raises `OverflowError` based on the **port** argument. Error reporting (or not) for its value is left up to the underlying C library `getaddrinfo()` implementation.
* GH-101797: allocate `PyExpat_CAPI` capsule on heap (#101798)Kumar Aditya2023-02-111-27/+45
|
* gh-101277: Finalise isolating itertools (GH-101305)Erlend E. Aasland2023-02-102-322/+218
| | | | | Add repeat, islice, chain, tee, teedataobject, and batched types to module state. Automerge-Triggered-By: GH:erlend-aasland
* gh-101430: Update tracemalloc to handle presize properly. (gh-101745)Dong-hee Na2023-02-091-16/+8
|
* GH-101228: Fix typo in docstring for read method of `_io.TextIOWrapper` ↵Partha P. Mukherjee2023-02-091-3/+3
| | | | class (#101227)
* gh-101678: Merge math_1_to_whatever() and math_1() (#101730)Sergey B Kirpichev2023-02-091-10/+2
| | | | | | `math_1_to_whatever()` is no longer useful, since all existing uses of it convert to `float`. Earlier versions of Python used `math_1_to_whatever` with an integer target; see gh-16991 for the PR where that use was removed.
* gh-101678: refactor the math module to use special functions from c11 ↵Sergey B Kirpichev2023-02-092-184/+8
| | | | | | | (GH-101679) Shouldn't affect users, hence no news. Automerge-Triggered-By: GH:mdickinson
* gh-101277: Port more itertools static types to heap types (#101304)Erlend E. Aasland2023-02-082-327/+200
| | | | Add accumulate, compress, count, filterfalse, pairwise, product, and zip_longest types to module state.
* gh-101196: Make isdir/isfile/exists faster on Windows (GH-101324)Michael Droettboom2023-02-082-1/+563
| | | Co-authored-by: Eryk Sun <eryksun@gmail.com>
* GH-101578: Normalize the current exception (GH-101607)Mark Shannon2023-02-083-12/+54
| | | | | | | | | | * Make sure that the current exception is always normalized. * Remove redundant type and traceback fields for the current exception. * Add new API functions: PyErr_GetRaisedException, PyErr_SetRaisedException * Add new API functions: PyException_GetArgs, PyException_SetArgs
* gh-101656: Fix "conversion from Py_ssize_t to int" warning in ↵Nikita Sobolev2023-02-071-3/+3
| | | | `_testcapimodule` (#101657)
* gh-101072: support default and kw default in PyEval_EvalCodeEx for 3.11+ ↵Matthieu Dartiailh2023-02-071-1/+140
| | | | | (#101127) Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-99108: Replace SHA2-224 & 256 with verified code from HACL* (#99109)Jonathan Protzenko2023-02-0711-346/+1753
| | | | | | | | | | | | | | | | | | | | | | replacing hashlib primitives (for the non-OpenSSL case) with verified implementations from HACL*. This is the first PR in the series, and focuses specifically on SHA2-256 and SHA2-224. This PR imports Hacl_Streaming_SHA2 into the Python tree. This is the HACL* implementation of SHA2, which combines a core implementation of SHA2 along with a layer of buffer management that allows updating the digest with any number of bytes. This supersedes the previous implementation in the tree. @franziskuskiefer was kind enough to benchmark the changes: in addition to being verified (thus providing significant safety and security improvements), this implementation also provides a sizeable performance boost! ``` --------------------------------------------------------------- Benchmark Time CPU Iterations --------------------------------------------------------------- Sha2_256_Streaming 3163 ns 3160 ns 219353 // this PR LibTomCrypt_Sha2_256 5057 ns 5056 ns 136234 // library used by Python currently ``` The changes in this PR are as follows: - import the subset of HACL* that covers SHA2-256/224 into `Modules/_hacl` - rewire sha256module.c to use the HACL* implementation Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-59956: Add a Test to Verify GILState Matches the "Current" Thread State ↵Eric Snow2023-02-061-0/+37
| | | | | | | (gh-101625) This test should have been in gh-101431. https://github.com/python/cpython/issues/59956