summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* Correct some typos in comments (GH-98194)jonasdlindner2022-11-061-1/+1
| | | Automerge-Triggered-By: GH:AlexWaygood
* gh-83004: Clean up refleak in _pickle initialisation (#98841)Shantanu2022-11-061-7/+6
|
* gh-83004: Clean up refleak in _zoneinfo initialisation (#98842)Shantanu2022-11-061-2/+3
|
* gh-94808: add tests covering `PyFunction_GetKwDefaults` and ↵Nikita Sobolev2022-11-051-0/+29
| | | | `PyFunction_SetKwDefaults` (GH-98809)
* gh-94808: add tests covering `PySequence_{Set,Del}Slice` (GH-99123)Nikita Sobolev2022-11-051-0/+33
|
* gh-94808: add tests covering `PyEval_GetFuncDesc` function (GH-98300)Nikita Sobolev2022-11-051-0/+7
|
* gh-73691: Increase size limits in _xxtestfuzz (#99070)Gregory P. Smith2022-11-031-3/+6
| | | | | | | | Now that our int<->str conversions are size limited and we have the _pylong module handling larger integers, we don't need to limit everything just to avoid wasting time in the quadratic time DoS-like case while fuzzing. We can tweak these further after seeing how this goes.
* GH-90699: Remove `_Py_IDENTIFIER` usage from `_ctypes` (GH-99054)Kumar Aditya2022-11-034-64/+35
|
* gh-83004: Clean up refleak in _io initialisation (#98840)Shantanu2022-11-031-3/+3
|
* gh-98740: Fix validation of conditional expressions in RE (GH-98764)Serhiy Storchaka2022-11-031-27/+29
| | | | | | | | | | | In very rare circumstances the JUMP opcode could be confused with the argument of the opcode in the "then" part which doesn't end with the JUMP opcode. This led to incorrect detection of the final JUMP opcode and incorrect calculation of the size of the subexpression. NOTE: Changed return value of functions _validate_inner() and _validate_charset() in Modules/_sre/sre.c. Now they return 0 on success, -1 on failure, and 1 if the last op is JUMP (which usually is a failure). Previously they returned 1 on success and 0 on failure.
* GH-90699: Remove `_Py_IDENTIFIER` usage from `_elementtree` module (GH-99012)Kumar Aditya2022-11-021-25/+59
|
* gh-98790: When DLLs directory is missing on Windows, assume executable_dir ↵Steve Dower2022-11-021-7/+21
| | | | contains PYD files instead (GH-98936)
* GH-90699: Remove `_Py_IDENTIFIER` usage from `_asyncio` module (#99010)Kumar Aditya2022-11-021-69/+38
|
* GH-90699: Remove `_Py_IDENTIFIER` usage from `_json` module (GH-98956)Kumar Aditya2022-11-021-29/+8
|
* GH-90699: Remove `_Py_IDENTIFIER` usage from `_curses` module (GH-98957)Kumar Aditya2022-11-021-12/+6
|
* 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
|