summaryrefslogtreecommitdiffstats
path: root/Modules
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* gh-94808: Add test coverage for PyObject_HasAttrString (#96627)MonadChains2022-10-031-0/+26
| | | | | | | * gh-94808: Add test for HasAttrString * Harmonize to Python C code style guidelines * Add check to verify no exception thrown
* gh-97728: Argument Clinic: Fix uninitialized variable in the Py_UNICODE ↵Serhiy Storchaka2022-10-033-14/+14
| | | | | | | converter (GH-97729) It affects function os.system() on Windows and Windows-specific modules winreg, _winapi, _overlapped, and _msi.
* GH-97592: Fix crash in C remove_done_callback due to evil code (#97660)Guido van Rossum2022-09-301-2/+7
| | | | Evil code could cause fut_callbacks to be cleared when PyObject_RichCompareBool is called.
* gh-94526: getpath_dirname() no longer encodes the path (#97645)Victor Stinner2022-09-301-9/+14
| | | | | | | | | | | Fix the Python path configuration used to initialized sys.path at Python startup. Paths are no longer encoded to UTF-8/strict to avoid encoding errors if it contains surrogate characters (bytes paths are decoded with the surrogateescape error handler). getpath_basename() and getpath_dirname() functions no longer encode the path to UTF-8/strict, but work directly on Unicode strings. These functions now use PyUnicode_FindChar() and PyUnicode_Substring() on the Unicode path, rather than strrchr() on the encoded bytes string.
* gh-96348: Deprecate the 3-arg signature of coroutine.throw and ↵Ofey Chan2022-09-301-0/+8
| | | | generator.throw (GH-96428)
* bpo-38748: Add ctypes test for stack corruption due to misaligned arguments ↵Michael Curran2022-09-261-0/+13
| | | | (GH-26204)
* Fix typo in docstring and remove duplicate signal.h include in ↵chgnrdv2022-09-261-2/+1
| | | | | faulthandler.c (#96720) This fix corrects a typo in dump_traceback_later function docstring and removes duplicate signal.h include directive
* GH-78724: Initialize struct.Struct in __new__ (GH-94532)Kumar Aditya2022-09-252-41/+34
| | | | Closes https://github.com/python/cpython/issues/75960 Closes https://github.com/python/cpython/issues/78724
* gh-96735: Fix undefined behaviour in struct unpacking functions (#96739)Mark Dickinson2022-09-251-26/+70
| | | | | | | | | | This PR fixes undefined behaviour in the struct module unpacking support functions `bu_longlong`, `lu_longlong`, `bu_int` and `lu_int`; thanks to @kumaraditya303 for finding these. The fix is to accumulate the bytes in an unsigned integer type instead of a signed integer type, then to convert to the appropriate signed type. In cases where the width matches, that conversion will typically be compiled away to a no-op. (Evidence from Godbolt: https://godbolt.org/z/5zvxodj64 .) To make the conversions efficient, I've specialised the relevant functions for their output size: for `bu_longlong` and `lu_longlong`, this only entails checking that the output size is indeed `8`. But `bu_int` and `lu_int` were used for format sizes `2` and `4` - I've split those into two separate functions each. No tests, because all of the affected cases are already exercised by the test suite.
* gh-97005: Update libexpat from 2.4.7 to 2.4.9 (gh-97006)Dong-hee Na2022-09-227-17/+27
| | | Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
* gh-96821: Fix undefined behaviour in `_testcapimodule.c` (GH-96915)Matthias Görgens2022-09-191-1/+3
| | | | | | | * gh-96821: Assert for demonstrating undefined behaviour * Fix UB Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* GH-91049: Introduce set vectorcall field API for PyFunctionObject (GH-92257)adphrost2022-09-151-0/+19
| | | | Co-authored-by: Andrew Frost <adfrost@fb.com> Co-authored-by: Itamar Ostricher <itamarost@gmail.com>
* closes gh-96734: Update to Unicode 15.0.0. (GH-96809)Benjamin Peterson2022-09-133-26699/+26982
|
* GH-96754: Check whether the interpreter frame is complete before creating ↵Mark Shannon2022-09-131-0/+3
| | | | frame object. (GH-96776)
* GH-46412: More efficient bool() for ndbm/_gdbmmodule (#96692)Guido van Rossum2022-09-092-0/+62
|
* gh-96652: Fix faulthandler chained signal without sigaction() (#96666)Victor Stinner2022-09-081-1/+1
| | | | | Fix the faulthandler implementation of faulthandler.register(signal, chain=True) if the sigaction() function is not available: don't call the previous signal handler if it's NULL.
* gh-96641: Do not expose `KeyWrapper` in `_functoolsmodule.c` (gh-96642)Nikita Sobolev2022-09-071-3/+2
|
* gh-96538: Fix refleak in _bisectmodule.c (gh-96619)Dennis Sweeney2022-09-061-0/+2
|
* GH-96612: Skip incomplete frames in tracemalloc traces. (GH-96613)Mark Shannon2022-09-061-3/+8
|
* gh-96538: Move some type-checking out of bisect.bisect() loops (GH-96539)Dennis Sweeney2022-09-051-16/+142
|
* gh-96143: Allow Linux perf profiler to see Python calls (GH-96123)Pablo Galindo Salgado2022-08-301-0/+5
| | | | | | | :warning: :warning: Note for reviewers, hackers and fellow systems/low-level/compiler engineers :warning: :warning: If you have a lot of experience with this kind of shenanigans and want to improve the **first** version, **please make a PR against my branch** or **reach out by email** or **suggest code changes directly on GitHub**. If you have any **refinements or optimizations** please, wait until the first version is merged before starting hacking or proposing those so we can keep this PR productive.
* gh-69142: add %:z strftime format code (gh-95983)TW2022-08-281-22/+42
| | | | | | | | | | | | | | | | datetime.isoformat generates the tzoffset with colons, but there was no format code to make strftime output the same format. for simplicity and consistency the %:z formatting behaves mostly as %z, with the exception of adding colons. this includes the dynamic behaviour of adding seconds and microseconds only when needed (when not 0). this fixes the still open "generate" part of this issue: https://github.com/python/cpython/issues/69142 Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>