Commit graph

115502 commits

Author SHA1 Message Date
Kai Zhang 228c92eb5c
gh-99582: freeze zipimport into _bootstrap_python (#99583)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2022-12-10 15:05:56 +05:30
ram vikram singh 7c0fb71fbf
gh-100049: fix repr for mappingproxy in dictionary view example doc (#100052) 2022-12-10 14:46:00 +05:30
Eric Snow 7a0f3c1d92
gh-81057: Fix a Reference Leak in the posix Module (gh-100140)
The leak was introduced in gh-100082.

https://github.com/python/cpython/issues/81057
2022-12-09 10:18:29 -07:00
Eric Snow 8d0bd93ae2
gh-81057: Fix the wasm32-wasi Buildbot (gh-100139)
The build was broken by gh-100084.

https://github.com/python/cpython/issues/81057
2022-12-09 10:17:54 -07:00
Raymond Hettinger 8c215466db
GH-98363: Shrink the physical size as well as the logical size (GH-100138) 2022-12-09 11:02:35 -06:00
andrei kulakov d0679c1239
bpo-44512: Fix handling of extrasactions arg to csv.DictWriter with mixed or upper case (#26924) 2022-12-09 16:14:33 +00:00
Shreyan Avigyan a29a7b9b78
bpo-43984: Allow winreg.SetValueEx to set -1 without treating it as an error (GH-25775) 2022-12-09 12:47:18 +00:00
Mark Shannon fb713b2183
GH-98522: Add version number to code objects. (GH-98525)
* Add version number to code object for better versioning of functions.

* Improves specialization for closures and list comprehensions.
2022-12-09 12:18:45 +00:00
Christian Rendina 3c5355496b
gh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888) 2022-12-09 11:16:15 +00:00
Ken Jin 748c6c0921
GH-100110: Specialize FOR_ITER for tuples (GH-100109)
* Specialize FOR_ITER for tuples
2022-12-09 10:27:01 +00:00
Kumar Aditya 0448deac70
GH-100113: remove remaining yield from usage from asyncio tests (#100114) 2022-12-09 09:22:18 +05:30
Stanley 286e3c76a9
gh-99087: Add missing newline for prompts in docs (GH-98993)
Add newline for prompts so copying to REPL does not cause errors.
2022-12-08 19:31:19 -08:00
Eric Snow 3e06b5030b
gh-81057: Fix an ifdef in the time module (#100125)
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
2022-12-08 18:16:37 -07:00
Eric Snow 1160001b34
gh-81057: Move Threading-Related Globals to _PyRuntimeState (#100084)
https://github.com/python/cpython/issues/81057
2022-12-08 17:50:58 -07:00
Eric Snow bc8cdf8c3d
gh-81057: Move Ceval Trampoline Globals to _PyRuntimeState (gh-100083)
https://github.com/python/cpython/issues/81057
2022-12-08 17:17:20 -07:00
Guido van Rossum 1cfa704f64
GH-98831: Generate things in the input order (#100123)
This makes it easier to see what changed in the generated code
when converting an instruction to super or macro.
2022-12-08 15:54:07 -08:00
Eric Snow 8a3f06c54b
gh-81057: Move time Globals to _PyRuntimeState (gh-100122)
https://github.com/python/cpython/issues/81057
2022-12-08 16:46:09 -07:00
Eric Snow cda9f0236f
gh-81057: Move OS-Related Globals to _PyRuntimeState (gh-100082)
https://github.com/python/cpython/issues/81057
2022-12-08 15:38:06 -07:00
Guido van Rossum c85be734d1
GH-98831: Typed stack effects, and more instructions converted (#99764)
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.
2022-12-08 13:31:27 -08:00
Raymond Hettinger 35cc0ea736
GH-98363: Have batched() return tuples (GH-100118) 2022-12-08 15:08:16 -06:00
Jia Junjie 41d4ac9da3
gh-96250: Improve sqlite3 injection attack example (#99270)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
2022-12-08 21:37:08 +01:00
Victor Stinner cd67c1bb30
test_ast uses infinite_recursion() to prevent crash (#100104)
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.
2022-12-08 09:26:38 +01:00
Fantix King e8fff515f0
Fix test_run_until_complete_baseexception test to check for KeyboardInterrupt in asyncio (#24477) 2022-12-08 13:51:04 +05:30
Ethan Furman ded02ca54d
gh-100098: [Enum] insist on actual tuples, no subclasses, for auto (GH-100099)
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.
2022-12-07 22:58:08 -08:00
Matthieu Baerts cce8362960
gh-98030: socket: add missing TCP socket options (#98031)
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>
2022-12-07 20:59:37 -08:00
Takeshi KOMIYA 90d5c9b195
gh-92120: The docstring of enum.Enum is invalid in reST (GH-92122)
Closes #92120
2022-12-07 18:24:52 -08:00
Dong-hee Na dc8a86893d
gh-98778: Update HTTPError to initialize properly even if fp is None (gh-99966) 2022-12-08 11:20:34 +09:00
Victor Stinner 3c89202247
gh-100086: Add build info to test.libregrtest (#100093)
The Python test runner (libregrtest) now logs Python build information like
"debug" vs "release" build, or LTO and PGO optimizations.
2022-12-08 01:38:47 +01:00
Eric Snow 91a8e002c2
gh-81057: Move More Globals to _PyRuntimeState (gh-100092)
https://github.com/python/cpython/issues/81057
2022-12-07 15:56:31 -07:00
Eric Snow d47ffeb9e3
gh-90110: Clean Up the C-analyzer Globals Lists (gh-100091)
https://github.com/python/cpython/issues/90110
2022-12-07 15:02:47 -07:00
Nikita Sobolev d92407ed49
gh-100072: only trigger netlify builds for doc changes (#100074)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-12-07 21:07:30 +02:00
Irit Katriel f3e97c90ed
gh-100077: make test_code.test_invalid_bytecode more robust and maintainable (#100078) 2022-12-07 18:09:05 +00:00
Carl Meyer 68e41295b8
gh-83035: handle decorator with nested parens in inspect.getsource (#99654) 2022-12-07 08:55:12 -08:00
Victor Stinner b11a384dc7
gh-98724: Fix Py_CLEAR() macro side effects (#99100) (#100070)
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.
2022-12-07 15:22:38 +01:00
Matěj Cepl 7031275776
gh-93018: Fix for the compatibility problems with expat (gh-93900) 2022-12-07 15:55:49 +09:00
Nikita Sobolev 889b0b9bf9
[Enum] Remove unused code from test_enum.py (GH-96986) 2022-12-06 18:44:47 -08:00
Pablo Galindo Salgado 97e7004cfe
gh-100050: Fix an assertion error when raising unclosed parenthesis errors in the tokenizer (GH-100065)
Automerge-Triggered-By: GH:pablogsal
2022-12-06 15:09:56 -08:00
Victor Stinner abbe4482ab
PyUnicode_KIND() uses _Py_RVALUE() (#100060)
The PyUnicode_KIND() macro is modified to use _Py_RVALUE(), so it can
no longer be used as a l-value.
2022-12-06 23:40:05 +01:00
Ethan Furman 679efbb080
gh-94943: [Enum] improve repr() when inheriting from a dataclass (GH-99740)
Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
2022-12-06 13:43:41 -08:00
Thomas Wouters 5da5aa4c3e Post 3.12.0a3 2022-12-06 22:20:28 +01:00
Thomas Wouters b6bd7ffcbc Python 3.12.0a3 2022-12-06 19:33:02 +01:00
Serhiy Storchaka fd38a2f0ec
gh-93453: No longer create an event loop in get_event_loop() (#98440)
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>
2022-12-06 18:42:12 +01:00
Brandt Bucher b72014c783
GH-99729: Unlink frames before clearing them (GH-100030) 2022-12-06 14:01:38 +00:00
Ashwin Ramaswami 85d5a7e8ef
bpo-37860: re-add netlify.toml to set up deploy previews for docs (#92852)
* Revert "bpo-46184: remove `netlify.toml` (#30272)"

This reverts commit fbaf2e604c.

* Delete runtime.txt

* Create runtime.txt

* Delete runtime.txt

* Update netlify.toml

* Update netlify.toml

* Add netlify badge

* Update Doc/tools/templates/layout.html

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Update layout.html

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-12-06 08:37:41 -05:00
Victor Stinner 5837e5f347
gh-100008: VS 2017 is required since Python 3.11 (#100045) 2022-12-06 14:35:32 +01:00
Michael Droettboom 9dc787ea96
GH-100026: Include the number of raw input files in summarize_stats.py (GH-100027) 2022-12-06 11:14:47 +00:00
Erik De Bonte 5c19050546
gh-99957: Add frozen_default parameter on dataclass_transform (#99958) 2022-12-05 19:35:43 -08:00
Gregory P. Smith bed15f87ea
gh-100001: Remove doc typo, add versionadded (#100042)
gh-100001: Remove new doc typo, add versionadded.
2022-12-05 15:15:13 -08:00
Gregory P. Smith 7e29398407
gh-100001: Also escape \s in http.server log messages. (#100038)
Also \ escape \s in the http.server BaseHTTPRequestHandler.log_message so
that it is technically possible to parse the line and reconstruct what the
original data was.  Without this a \xHH is ambiguious as to if it is a hex
replacement we put in or the characters r"\x" came through in the original
request line.
2022-12-05 14:27:55 -08:00
Eric Snow e9e63ad865
gh-99984: Fix Compiler Warnings (#100036)
https://github.com/python/cpython/issues/99984
2022-12-05 14:41:06 -07:00