summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* gh-100174: [Enum] Correct PowersOfThree example. (GH-100178)Beweeted2022-12-111-2/+2
| | | Changed from multiples of 3 to powers of 3 to match the class name.
* gh-88500: Reduce memory use of `urllib.unquote` (#96763)Gregory P. Smith2022-12-113-11/+23
| | | | | | | | | | | `urllib.unquote_to_bytes` and `urllib.unquote` could both potentially generate `O(len(string))` intermediate `bytes` or `str` objects while computing the unquoted final result depending on the input provided. As Python objects are relatively large, this could consume a lot of ram. This switches the implementation to using an expanding `bytearray` and a generator internally instead of precomputed `split()` style operations. Microbenchmarks with some antagonistic inputs like `mess = "\u0141%%%20a%fe"*1000` show this is 10-20% slower for unquote and unquote_to_bytes and no different for typical inputs that are short or lack much unicode or % escaping. But the functions are already quite fast anyways so not a big deal. The slowdown scales consistently linear with input size as expected. Memory usage observed manually using `/usr/bin/time -v` on `python -m timeit` runs of larger inputs. Unittesting memory consumption is difficult and does not seem worthwhile. Observed memory usage is ~1/2 for `unquote()` and <1/3 for `unquote_to_bytes()` using `python -m timeit -s 'from urllib.parse import unquote, unquote_to_bytes; v="\u0141%01\u0161%20"*500_000' 'unquote_to_bytes(v)'` as a test.
* gh-99941: Ensure that asyncio.Protocol.data_received receives immutable ↵DarioDaF2022-12-104-4/+10
| | | | bytes (#100053)
* gh-99728: correct typo in `datetime` format codes documentation (#99750)Brad Wolfe2022-12-101-1/+1
|
* gh-99970 Adding missing `optionflags` parameter in the documentation of ↵busywhitespace2022-12-101-1/+1
| | | | `doctest` (#99971)
* Fix potential flakiness in `test_run_until_complete_baseexception` (#100148)Fantix King2022-12-100-0/+0
|
* Fix potential flakiness in `test_run_until_complete_baseexception` (#100148)Fantix King2022-12-100-0/+0
|
* Fix potential flakiness in `test_run_until_complete_baseexception` (#100148)Fantix King2022-12-101-1/+1
|
* gh-99582: freeze `zipimport` into `_bootstrap_python` (#99583)Kai Zhang2022-12-103-1/+5
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-100049: fix `repr` for `mappingproxy` in dictionary view example doc ↵ram vikram singh2022-12-101-1/+1
| | | | (#100052)
* gh-81057: Fix a Reference Leak in the posix Module (gh-100140)Eric Snow2022-12-091-0/+1
| | | | | The leak was introduced in gh-100082. https://github.com/python/cpython/issues/81057
* gh-81057: Fix the wasm32-wasi Buildbot (gh-100139)Eric Snow2022-12-092-2/+3
| | | | | The build was broken by gh-100084. https://github.com/python/cpython/issues/81057
* GH-98363: Shrink the physical size as well as the logical size (GH-100138)Raymond Hettinger2022-12-091-2/+1
|
* bpo-44512: Fix handling of extrasactions arg to csv.DictWriter with mixed or ↵andrei kulakov2022-12-093-1/+12
| | | | upper case (#26924)
* bpo-43984: Allow winreg.SetValueEx to set -1 without treating it as an error ↵Shreyan Avigyan2022-12-093-33/+64
| | | | (GH-25775)
* GH-98522: Add version number to code objects. (GH-98525)Mark Shannon2022-12-0910-4/+23
| | | | | | * Add version number to code object for better versioning of functions. * Improves specialization for closures and list comprehensions.
* gh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888)Christian Rendina2022-12-092-3/+10
|
* GH-100110: Specialize FOR_ITER for tuples (GH-100109)Ken Jin2022-12-0910-67/+122
| | | * Specialize FOR_ITER for tuples
* GH-100113: remove remaining `yield from` usage from `asyncio` tests (#100114)Kumar Aditya2022-12-091-2/+2
|
* gh-99087: Add missing newline for prompts in docs (GH-98993)Stanley2022-12-0922-0/+43
| | | Add newline for prompts so copying to REPL does not cause errors.
* gh-81057: Fix an ifdef in the time module (#100125)Eric Snow2022-12-091-2/+4
| | | | | An earlier commit only defined check_ticks_per_second() when HAVE_TIMES is defined. However, we also need it when HAVE_CLOCK is defined. This primarily affects Windows. https://github.com/python/cpython/issues/81057
* gh-81057: Move Threading-Related Globals to _PyRuntimeState (#100084)Eric Snow2022-12-0911-54/+114
| | | https://github.com/python/cpython/issues/81057
* gh-81057: Move Ceval Trampoline Globals to _PyRuntimeState (gh-100083)Eric Snow2022-12-099-84/+125
| | | https://github.com/python/cpython/issues/81057
* GH-98831: Generate things in the input order (#100123)Guido van Rossum2022-12-082-261/+269
| | | | This makes it easier to see what changed in the generated code when converting an instruction to super or macro.
* gh-81057: Move time Globals to _PyRuntimeState (gh-100122)Eric Snow2022-12-0814-118/+100
| | | https://github.com/python/cpython/issues/81057
* gh-81057: Move OS-Related Globals to _PyRuntimeState (gh-100082)Eric Snow2022-12-0814-27/+107
| | | https://github.com/python/cpython/issues/81057
* GH-98831: Typed stack effects, and more instructions converted (#99764)Guido van Rossum2022-12-084-604/+545
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stack effects can now have a type, e.g. `inst(X, (left, right -- jump/uint64_t)) { ... }`. Instructions converted to the non-legacy format: * COMPARE_OP * COMPARE_OP_FLOAT_JUMP * COMPARE_OP_INT_JUMP * COMPARE_OP_STR_JUMP * STORE_ATTR * DELETE_ATTR * STORE_GLOBAL * STORE_ATTR_INSTANCE_VALUE * STORE_ATTR_WITH_HINT * STORE_ATTR_SLOT, and complete the store_attr family * Complete the store_subscr family: STORE_SUBSCR{,DICT,LIST_INT} (STORE_SUBSCR was alread half converted, but wasn't using cache effects yet.) * DELETE_SUBSCR * PRINT_EXPR * INTERPRETER_EXIT (a bit weird, ends in return) * RETURN_VALUE * GET_AITER (had to restructure it some) The original had mysterious `SET_TOP(NULL)` before `goto error`. I assume those just account for `obj` having been decref'ed, so I got rid of them in favor of the cleanup implied by `ERROR_IF()`. * LIST_APPEND (a bit unhappy with it) * SET_ADD (also a bit unhappy with it) Various other improvements/refactorings as well.
* GH-98363: Have batched() return tuples (GH-100118)Raymond Hettinger2022-12-084-38/+40
|
* gh-96250: Improve sqlite3 injection attack example (#99270)Jia Junjie2022-12-081-6/+10
| | | | Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* test_ast uses infinite_recursion() to prevent crash (#100104)Victor Stinner2022-12-081-1/+2
| | | | | | | test.test_ast_recursion_limit() now uses infinite_recursion() of test.support to prevent crashes on debug builds. Before this change, the test crashed on ARM64 Windows 3.x buildbot worker which builds Python in debug mode.
* Fix `test_run_until_complete_baseexception` test to check for ↵Fantix King2022-12-081-8/+3
| | | | `KeyboardInterrupt` in asyncio (#24477)
* gh-100098: [Enum] insist on actual tuples, no subclasses, for auto (GH-100099)Ethan Furman2022-12-083-1/+17
| | | | | | When checking for auto() instances, only top-level usage is supported, which means either alone or as part of a regular tuple. Other containers, such as lists, dicts, or namedtuples, will not have auto() transformed into a value.
* gh-98030: socket: add missing TCP socket options (#98031)Matthieu Baerts2022-12-083-4/+78
| | | | | | | | | | | | | A few TCP socket options have been added to the Linux kernel these last few years. This commit adds all the ones available in Linux 6.0: https://elixir.bootlin.com/linux/v6.0/source/include/uapi/linux/tcp.h#L91 While at it, the TCP_FASTOPEN option has been moved lower in the list just to keep the same order as in tcp.h to ease future synchronisations. Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
* gh-92120: The docstring of enum.Enum is invalid in reST (GH-92122)Takeshi KOMIYA2022-12-082-7/+8
| | | Closes #92120
* gh-98778: Update HTTPError to initialize properly even if fp is None (gh-99966)Dong-hee Na2022-12-083-7/+10
|
* gh-100086: Add build info to test.libregrtest (#100093)Victor Stinner2022-12-083-1/+91
| | | | The Python test runner (libregrtest) now logs Python build information like "debug" vs "release" build, or LTO and PGO optimizations.
* gh-81057: Move More Globals to _PyRuntimeState (gh-100092)Eric Snow2022-12-0714-56/+66
| | | https://github.com/python/cpython/issues/81057
* gh-90110: Clean Up the C-analyzer Globals Lists (gh-100091)Eric Snow2022-12-074-441/+487
| | | https://github.com/python/cpython/issues/90110
* gh-100072: only trigger netlify builds for doc changes (#100074)Nikita Sobolev2022-12-071-1/+4
| | | Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* gh-100077: make test_code.test_invalid_bytecode more robust and maintainable ↵Irit Katriel2022-12-071-8/+12
| | | | (#100078)
* gh-83035: handle decorator with nested parens in inspect.getsource (#99654)Carl Meyer2022-12-074-9/+22
|
* gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#100070)Victor Stinner2022-12-077-29/+235
| | | | | | | | | | | | | | The Py_CLEAR(), Py_SETREF() and Py_XSETREF() macros now only evaluate their arguments once. If an argument has side effects, these side effects are no longer duplicated. Use temporary variables to avoid duplicating side effects of macro arguments. If available, use _Py_TYPEOF() to avoid type punning. Otherwise, use memcpy() for the assignment to prevent a miscompilation with strict aliasing caused by type punning. Add _Py_TYPEOF() macro: __typeof__() on GCC and clang. Add test_py_clear() and test_py_setref() unit tests to _testcapi.
* gh-93018: Fix for the compatibility problems with expat (gh-93900)Matěj Cepl2022-12-072-15/+10
|
* [Enum] Remove unused code from `test_enum.py` (GH-96986)Nikita Sobolev2022-12-071-14/+0
|
* gh-100050: Fix an assertion error when raising unclosed parenthesis errors ↵Pablo Galindo Salgado2022-12-063-0/+22
| | | | | in the tokenizer (GH-100065) Automerge-Triggered-By: GH:pablogsal
* PyUnicode_KIND() uses _Py_RVALUE() (#100060)Victor Stinner2022-12-061-1/+1
| | | | The PyUnicode_KIND() macro is modified to use _Py_RVALUE(), so it can no longer be used as a l-value.
* gh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740)Ethan Furman2022-12-065-4/+102
| | | Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
* Post 3.12.0a3Thomas Wouters2022-12-061-1/+1
|
* Python 3.12.0a3v3.12.0a3Thomas Wouters2022-12-0684-193/+847
|
* gh-93453: No longer create an event loop in get_event_loop() (#98440)Serhiy Storchaka2022-12-0618-251/+114
| | | | | | | | | | | | | | | asyncio.get_event_loop() now always return either running event loop or the result of get_event_loop_policy().get_event_loop() call. The latter should now raise an RuntimeError if no current event loop was set instead of creating and setting a new event loop. It affects also a number of asyncio functions and constructors which call get_event_loop() implicitly: ensure_future(), shield(), gather(), etc. DeprecationWarning is no longer emitted if there is no running event loop but the current event loop was set. Co-authored-by: Łukasz Langa <lukasz@langa.pl>