summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
...
* gh-98658: Add __class_getitem__ to array.array (#98661)Jelle Zijlstra2022-11-011-0/+1
| | | Closes #98658
* GH-98897: fix memory leak if `math.dist` raises exception (GH-98898)Kumar Aditya2022-11-011-3/+3
|
* gh-98610: Adjust the Optional Restrictions on Subinterpreters (GH-98618)Eric Snow2022-10-316-28/+56
| | | | | | | Previously, the optional restrictions on subinterpreters were: disallow fork, subprocess, and threads. By default, we were disallowing all three for "isolated" interpreters. We always allowed all three for the main interpreter and those created through the legacy `Py_NewInterpreter()` API. Those settings were a bit conservative, so here we've adjusted the optional restrictions to: fork, exec, threads, and daemon threads. The default for "isolated" interpreters disables fork, exec, and daemon threads. Regular threads are allowed by default. We continue always allowing everything For the main interpreter and the legacy API. In the code, we add `_PyInterpreterConfig.allow_exec` and `_PyInterpreterConfig.allow_daemon_threads`. We also add `Py_RTFLAGS_DAEMON_THREADS` and `Py_RTFLAGS_EXEC`.
* gh-98793: Fix typecheck in `overlapped.c` (#98835)Charlie Zhao2022-10-302-5/+13
| | | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* Fix comment typos in `_operator.c` (#98853)David Buchanan2022-10-291-2/+2
|
* gh-98739: Update libexpat from 2.4.9 to 2.5.0 (#98742)Shaun Walbridge2022-10-273-18/+35
| | | | | * Update libexpat from 2.4.9 to 2.5.0 to address CVE-2022-43680. Co-authored-by: Shaun Walbridge <shaun.walbridge@gmail.com>
* gh-98586: Add vector call APIs to the Limited API (GH-98587)Wenzel Jakob2022-10-271-4/+101
| | | Expose the facilities for making vector calls through Python's limited API.
* gh-94808: cover `PyFunction_GetDefaults` and `PyFunction_SetDefaults` (#98449)Nikita Sobolev2022-10-271-0/+29
|
* Fix readline.c compiler warning. (GH-98738)Benjamin Peterson2022-10-261-1/+1
| | | | | | | ``` Modules/readline.c:1260:37: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] completer_word_break_characters = ^ ```
* gh-98608: Change _Py_NewInterpreter() to _Py_NewInterpreterFromConfig() ↵Eric Snow2022-10-267-7/+119
| | | | | | | | | | | | | | | | | | | | | | | | | (gh-98609) (see https://github.com/python/cpython/issues/98608) This change does the following: 1. change the argument to a new `_PyInterpreterConfig` struct 2. rename the function to `_Py_NewInterpreterFromConfig()`, inspired by `Py_InitializeFromConfig()` (takes a `_PyInterpreterConfig` instead of `isolated_subinterpreter`) 3. split up the boolean `isolated_subinterpreter` into the corresponding multiple granular settings * allow_fork * allow_subprocess * allow_threads 4. add `PyInterpreterState.feature_flags` to store those settings 5. add a function for checking if a feature is enabled on an opaque `PyInterpreterState *` 6. drop `PyConfig._isolated_interpreter` The existing default (see `Py_NewInterpeter()` and `Py_Initialize*()`) allows fork, subprocess, and threads and the optional "isolated" interpreter (see the `_xxsubinterpreters` module) disables all three. None of that changes here; the defaults are preserved. Note that the given `_PyInterpreterConfig` will not be used outside `_Py_NewInterpreterFromConfig()`, nor preserved. This contrasts with how `PyConfig` is currently preserved, used, and even modified outside `Py_InitializeFromConfig()`. I'd rather just avoid that mess from the start for `_PyInterpreterConfig`. We can preserve it later if we find an actual need. This change allows us to follow up with a number of improvements (e.g. stop disallowing subprocess and support disallowing exec instead). (Note that this PR adds "private" symbols. We'll probably make them public, and add docs, in a separate change.)
* gh-94808: cover `PyMapping_HasKeyString` and `PyMapping_HasKey` (#98486)Nikita Sobolev2022-10-261-0/+36
|
* gh-91524: Speed up the regular expression substitution (#91525)Serhiy Storchaka2022-10-234-43/+329
| | | | | | | | | Functions re.sub() and re.subn() and corresponding re.Pattern methods are now 2-3 times faster for replacement strings containing group references. Closes #91524 Primarily authored by serhiy-storchaka Serhiy Storchaka Minor-cleanups-by: Gregory P. Smith [Google] <greg@krypto.org>
* GH-98363: Slicing isn't necessary. A size reduction will suffice. (GH-98538)Raymond Hettinger2022-10-221-7/+6
|
* GH-98363: Use better accessor macro (#98535)Raymond Hettinger2022-10-211-1/+1
|
* bpo-2716: add license for audioop module (#19972)Furkan Onder2022-10-211-14/+30
|
* GH-98363: Fix exception handling in batched() (GH-98523)Raymond Hettinger2022-10-211-8/+21
|
* gh-91051: allow setting a callback hook on PyType_Modified (GH-97875)Carl Meyer2022-10-211-0/+127
|
* gh-95023: Added os.setns and os.unshare functions (#95046)Noam Cohen2022-10-202-1/+257
| | | | | | | | Added os.setns and os.unshare to easily switch between namespaces on Linux. Co-authored-by: Christian Heimes <christian@python.org> Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Victor Stinner <vstinner@python.org>
* GH-98363: Presize the list for batched() (GH-98419)Raymond Hettinger2022-10-201-13/+13
|
* gh-98393: os module reject bytes-like, only accept bytes (#98394)Victor Stinner2022-10-181-27/+5
| | | | | The os module and the PyUnicode_FSDecoder() function no longer accept bytes-like paths, like bytearray and memoryview types: only the exact bytes type is accepted for bytes strings.
* Fix typos in comments (GH-98375)Raymond Hettinger2022-10-181-2/+2
|
* GH-98363: Add itertools.batched() (GH-98364)Raymond Hettinger2022-10-172-2/+250
|
* Remove unused arrange_output_buffer function from zlibmodule.c. (GH-98358)Benjamin Peterson2022-10-171-16/+0
|
* gh-97669: Create Tools/build/ directory (#97963)Victor Stinner2022-10-172-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Create Tools/build/ directory. Move the following scripts from Tools/scripts/ to Tools/build/: * check_extension_modules.py * deepfreeze.py * freeze_modules.py * generate_global_objects.py * generate_levenshtein_examples.py * generate_opcode_h.py * generate_re_casefix.py * generate_sre_constants.py * generate_stdlib_module_names.py * generate_token.py * parse_html5_entities.py * smelly.py * stable_abi.py * umarshal.py * update_file.py * verify_ensurepip_wheels.py Update references to these scripts.
* gh-95534: Improve gzip reading speed by 10% (#97664)Ruben Vorderman2022-10-172-68/+670
| | | | | | | | | Change summary: + There is now a `gzip.READ_BUFFER_SIZE` constant that is 128KB. Other programs that read in 128KB chunks: pigz and cat. So this seems best practice among good programs. Also it is faster than 8 kb chunks. + a zlib._ZlibDecompressor was added. This is the _bz2.BZ2Decompressor ported to zlib. Since the zlib.Decompress object is better for in-memory decompression, the _ZlibDecompressor is hidden. It only makes sense in file decompression, and that is already implemented now in the gzip library. No need to bother the users with this. + The ZlibDecompressor uses the older Cpython arrange_output_buffer functions, as those are faster and more appropriate for the use case. + GzipFile.read has been optimized. There is no longer a `unconsumed_tail` member to write back to padded file. This is instead handled by the ZlibDecompressor itself, which has an internal buffer. `_add_read_data` has been inlined, as it was just two calls. EDIT: While I am adding improvements anyway, I figured I could add another one-liner optimization now to the python -m gzip application. That read chunks in io.DEFAULT_BUFFER_SIZE previously, but has been updated now to use READ_BUFFER_SIZE chunks.
* gh-94808: Cover `PyFunction_GetCode`, `PyFunction_GetGlobals`, ↵Nikita Sobolev2022-10-161-0/+39
| | | | `PyFunction_GetModule` (#98158)
* gh-94808: Cover `PyEval_GetFuncName` (#98246)Nikita Sobolev2022-10-151-0/+7
|
* gh-98178: syslog() is not thread-safe on macOS (#98213)Victor Stinner2022-10-131-0/+5
| | | | | | On macOS, fix a crash in syslog.syslog() in multi-threaded applications. On macOS, the libc syslog() function is not thread-safe, so syslog.syslog() no longer releases the GIL to call it.
* signalmodule.c uses _PyErr_WriteUnraisableMsg() (#98217)Victor Stinner2022-10-121-7/+6
| | | | | | | Signal wakeup fd errors are now logged with _PyErr_WriteUnraisableMsg(), rather than PySys_WriteStderr() and PyErr_WriteUnraisable(), to pass the error message to sys.unraisablehook. By default, it's still written into stderr (unless sys.unraisablehook is overriden).
* gh-44098: Release the GIL during mmap on Unix (GH-98146)Shantanu2022-10-101-3/+3
| | | | | This seems pretty straightforward. The issue mentions other calls in mmapmodule that we could release the GIL on, but those are in methods where we'd need to be careful to ensure that something sensible happens if those are called concurrently. In prior art, note that #12073 released the GIL for munmap. In a toy benchmark, I see the speedup you'd expect from doing this. Automerge-Triggered-By: GH:gvanrossum
* gh-96821: Fix undefined behaviour in `audioop.c` (#96923)Matthias Görgens2022-10-101-12/+15
| | | | | | | | | | | * gh-96821: Fix undefined behaviour in `audioop.c` Left-shifting negative numbers is undefined behaviour. Fortunately, multiplication works just as well, is defined behaviour, and gets compiled to the same machine code as before by optimizing compilers. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* gh-94808: Add coverage for bytesarray_setitem (#95802)Michael Droettboom2022-10-101-0/+15
|
* gh-95011: Migrate syslog module to Argument Clinic (GH-95012)Noam Cohen2022-10-082-72/+353
|
* gh-97922: Run the GC only on eval breaker (#97920)Pablo Galindo Salgado2022-10-082-3/+37
|
* gh-91052: Add PyDict_Unwatch for unwatching a dictionary (#98055)Carl Meyer2022-10-081-0/+15
|
* gh-96288: Add a sentence to `os.mkdir`'s docstring. (#96271)Hagai Helman Tov2022-10-072-4/+6
|
* gh-65496: Correct wording on csv's skipinitialspace argument (#96170)Stanley2022-10-071-4/+4
|
* gh-97955: Migrate `zoneinfo` to Argument Clinic (#97958)Nikita Sobolev2022-10-072-36/+236
|
* gh-64373: Convert `_functools` to Argument Clinic (#96640)Nikita Sobolev2022-10-072-29/+161
|
* Add more syslog tests (GH-97953)Serhiy Storchaka2022-10-071-1/+1
|
* Fix memory leaks in test_capi (#98017)Carl Meyer2022-10-071-0/+3
|
* GH-90985: Revert "Deprecate passing a message into cancel()" (#97999)Guido van Rossum2022-10-071-20/+0
| | | | | Reason: we were too hasty in deprecating this. We shouldn't deprecate it before we have a replacement.
* GH-91052: Add C API for watching dictionaries (GH-31787)Carl Meyer2022-10-071-0/+140
|
* fixes gh-96078: os.sched_yield release the GIL while calling sched_yield(2). ↵Dong-hee Na2022-10-061-1/+6
| | | | (gh-97965)
* gh-94590: add signatures to operator itemgetter, attrgetter, methodcaller ↵Erik Welch2022-10-061-6/+3
| | | | | | | | | | | | | (#94591) These were intentionally skipped when operator was updated to use the argument clinic: https://github.com/python/cpython/issues/64385#issuecomment-1093641466 However, by not using the argument clinic, they missed out on getting signatures. This is a narrow PR to update the docstrings so that `__text_signature__` can be extracted from them. Updating to use the argument clinic is beyond scope. `methodcaller` uses `*args, **kwargs` to match variadic names used elsewhere, including in `operator.call`.
* gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (GH-97944)Ned Deily2022-10-061-8/+52
| | | | | | | | The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls. Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a segfault if cpython is built with the macOS 13 SDK but run on an earlier version of macOS. Prevent this by adding runtime support for detection of these system calls ("weaklinking") as is done for other newer syscalls on macOS.
* gh-94808: Cover `PyUnicode_Count` in CAPI (#96929)Nikita Sobolev2022-10-061-0/+21
|
* gh-97758: Fix a crash in getpath_joinpath() called without arguments (GH-97759)Serhiy Storchaka2022-10-051-1/+1
|
* GH-96704: Add {Task,Handle}.get_context(), use it in ↵Guido van Rossum2022-10-052-1/+31
| | | | | call_exception_handler() (#96756) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* GH-91079: Decouple C stack overflow checks from Python recursion checks. ↵Mark Shannon2022-10-051-3/+1
| | | | (GH-96510)