Commit Graph

122885 Commits

Author SHA1 Message Date
Serhiy Storchaka 974a978631
gh-120873: Add test for "state" option in ttk.Scale (GH-120874)
Also refactor the "state" option tests for other ttk widgets.
2024-06-22 11:18:04 +00:00
Victor Stinner 879d1f28bb
gh-119182: Use PyUnicodeWriter_WriteWideChar() (#120851)
Use PyUnicodeWriter_WriteWideChar() in PyUnicode_FromFormat()
2024-06-22 08:58:22 +02:00
Serhiy Storchaka 6ad26de6e8
gh-104855: Update Tkinter tests for Tcl/Tk 8.7 and 9.0 (GH-120824)
The tests are now passed with the current version of Tcl/Tk under
development (8.7b1+ and 9.0b3+).

The following changes were also made to make the tests more flexible:

* Helper methods like checkParam() now interpret the expected error message
  as a regular expression instead of a literal.
* Add support of new arguments in checkEnumParam():
  - allow_empty=True skips testing with empty string;
  - fullname= specifies the name for error message if it differs from the
    option name;
  - sort=True sorts values for error message.
* Add support of the allow_empty argument in checkReliefParam():
  allow_empty=True adds an empty string to the list of accepted values.
* Attributes _clip_highlightthickness, _clip_pad and  _clip_borderwidth
  specify how negative values of options -highlightthickness, -padx, -pady
  and -borderwidth are handled.
* Use global variables for some common error messages.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-06-22 09:53:24 +03:00
Sam Gross 8f17d69b7b
gh-119344: Make critical section API public (#119353)
This makes the following macros public as part of the non-limited C-API for
locking a single object or two objects at once.

* `Py_BEGIN_CRITICAL_SECTION(op)` / `Py_END_CRITICAL_SECTION()`
* `Py_BEGIN_CRITICAL_SECTION2(a, b)` / `Py_END_CRITICAL_SECTION2()`

The supporting functions and structs used by the macros are also exposed for
cases where C macros are not available.
2024-06-21 15:50:18 -04:00
Eric Snow 03fa2df927
gh-120838: Add a Note in the Docs About Expectations for Py_Finalize() (gh-120839) 2024-06-21 13:05:53 -06:00
Nice Zombies 462832041e
gh-119003: Clarify slice assignments (#119935) 2024-06-21 11:30:50 -07:00
Nice Zombies 1dadcb5a6a
Amend categories of @nineteendo's news entries (#120735) 2024-06-21 13:20:13 -05:00
Victor Stinner 913a956d85
gh-119182: Rewrite PyUnicodeWriter tests in Python (#120845) 2024-06-21 20:15:06 +02:00
Victor Stinner 4123226bbd
gh-119182: Add PyUnicodeWriter_DecodeUTF8Stateful() (#120639)
Add PyUnicodeWriter_WriteWideChar() and
PyUnicodeWriter_DecodeUTF8Stateful() functions.

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-06-21 19:33:15 +02:00
Peter aed31beca9
gh-120811: Fix reference leak upon `_PyContext_Exit` failure (#120812)
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
2024-06-21 17:28:19 +00:00
neonene a81d434c06
gh-120782: Update internal type cache when reloading datetime (#120829) 2024-06-21 22:39:33 +05:30
Petr Viktorin 6f1d448bc1
gh-113993: Allow interned strings to be mortal, and fix related issues (GH-120520)
* Add an InternalDocs file describing how interning should work and how to use it.

* Add internal functions to *explicitly* request what kind of interning is done:
  - `_PyUnicode_InternMortal`
  - `_PyUnicode_InternImmortal`
  - `_PyUnicode_InternStatic`

* Switch uses of `PyUnicode_InternInPlace` to those.

* Disallow using `_Py_SetImmortal` on strings directly.
  You should use `_PyUnicode_InternImmortal` instead:
  - Strings should be interned before immortalization, otherwise you're possibly
    interning a immortalizing copy.
  - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to
    `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in
    backports, as they are now part of public API and version-specific ABI.

* Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery.

* Make sure the statically allocated string singletons are unique. This means these sets are now disjoint:
  - `_Py_ID`
  - `_Py_STR` (including the empty string)
  - one-character latin-1 singletons

  Now, when you intern a singleton, that exact singleton will be interned.

* Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic).

* Intern `_Py_STR` singletons at startup.

* For free-threaded builds, intern `_Py_LATIN1_CHR` singletons at startup.

* Beef up the tests. Cover internal details (marked with `@cpython_only`).

* Add lots of assertions

Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
2024-06-21 17:19:31 +02:00
Bénédikt Tran 7595e6743a
gh-120380: fix Python implementation of `pickle.Pickler` for `bytes` and `bytearray` objects in protocol version 5. (GH-120422) 2024-06-21 14:22:38 +02:00
blhsing 83d3d7aace
gh-120773: document introspective attributes of an async generator object in the inspect module (#120778) 2024-06-21 10:55:36 +00:00
Nikita Sobolev 8334a1b55c
gh-120384: Fix array-out-of-bounds crash in `list_ass_subscript` (#120442) 2024-06-21 13:48:38 +03:00
Kumar Aditya 733dac01b0
GH-120804: Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio (#120805)
Remove SafeChildWatcher, FastChildWatcher and MultiLoopChildWatcher from asyncio. These child watchers have been deprecated since Python 3.12. The tests are also removed and some more tests will be added after the rewrite of child watchers.
2024-06-21 10:23:10 +05:30
Serhiy Storchaka a2f6f7dd26
gh-111259: Document idiomatic RE pattern (?s:.) that matches any character (GH-120745) 2024-06-21 00:03:49 +03:00
Victor Stinner 56657f6be2
gh-119182: Use public PyUnicodeWriter in contextvar_tp_repr() (#120809)
The public PyUnicodeWriter API enables overallocation by default and
so is more efficient. It also makes the code simpler and shorter.
2024-06-20 19:56:47 +00:00
Victor Stinner 5150795b1c
gh-119182: Optimize PyUnicode_FromFormat() (#120796)
Use strchr() and ucs1lib_find_max_char() to optimize the code path
formatting sub-strings between '%' formats.
2024-06-20 19:06:16 +00:00
Jason R. Coombs 85d90b59e2
gh-120801: Refactor importlib.metadata fixtures. (#120803)
These changes released with importlib_metadata 7.2.0.
2024-06-20 19:00:39 +00:00
Victor Stinner c1553bc34a
gh-119182: Use public PyUnicodeWriter API in union_repr() (#120797)
The public PyUnicodeWriter API enables overallocation by default and
so is more efficient.

Benchmark:

python -m pyperf timeit \
    -s 't = int | float | complex | str | bytes | bytearray' \
       ' | memoryview | list | dict' \
    'str(t)'

Result:

1.29 us +- 0.02 us -> 1.00 us +- 0.02 us: 1.29x faster
2024-06-20 20:39:34 +02:00
Victor Stinner 73b4492c19
gh-119182: Use public PyUnicodeWriter API in ga_repr() (#120799)
The public PyUnicodeWriter API enables overallocation by default and
so is more efficient.

Benchmark:

python -m pyperf timeit \
    -s 't = list[int, float, complex, str, bytes, bytearray, ' \
                 'memoryview, list, dict]' \
    'str(t)'

Result:

1.49 us +- 0.03 us -> 1.10 us +- 0.02 us: 1.35x faster
2024-06-20 20:35:35 +02:00
Tian Gao 31ce5c05a4
gh-120769: Add pdb meta command to print frame status. (#120770) 2024-06-20 10:38:07 -07:00
Sam Gross 3af7263037
gh-117511: Make PyMutex public in the non-limited API (#117731) 2024-06-20 11:29:08 -04:00
Jelle Zijlstra e8e151d471
gh-120780: Show attribute name for LOAD_SPECIAL in dis output (#120781) 2024-06-20 07:07:24 -07:00
Irit Katriel 55596ae044
gh-98442: fix locations of with statement's cleanup instructions (#120763)
gh-98442: fix location of with statement's cleanup instructions
2024-06-20 09:32:06 +01:00
Serhiy Storchaka 8bc76ae45f
gh-111259: Optimize complementary character sets in RE (GH-120742)
Patterns like "[\s\S]" or "\s|\S" which match any character are now compiled
to the same effective code as a dot with the DOTALL modifier ("(?s:.)").
2024-06-20 07:19:32 +00:00
Jelle Zijlstra 3846fcfb92
gh-119698: symtable: Fix merge race (#120779) 2024-06-20 05:42:30 +00:00
Bénédikt Tran b8a8e04fec
gh-119698: fix `symtable.Class.get_methods` and document its behaviour correctly (#120151)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-19 20:49:30 -07:00
Xie Yanbo 656a1c8108
Fix typos in comments (#120481) 2024-06-19 23:16:14 -04:00
Xarblu 285f42c850
GH-120602: Support LLVM_VERSION_SUFFIX for JIT builds (GH-120604) 2024-06-19 17:48:00 -07:00
Tian Gao 4bbb0273f2
gh-120606: Allow EOF to exit pdb commands definition (#120607) 2024-06-19 15:50:26 -07:00
Nikita Sobolev 1e4815692f
gh-120732: Fix `name` passing to `Mock`, when using kwargs to `create_autospec` (#120737) 2024-06-19 21:35:11 +01:00
Nice Zombies ed5ae6c4d7
gh-118820: Zero-valued flag enum has no name (GH-118848)
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-06-19 13:09:53 -07:00
Kirill Podoprigora 753ef8db97
Regen ``Doc/requirements-oldest-sphinx.txt`` (#120753) 2024-06-19 19:21:12 +00:00
Danny Yang 58b3f11176
gh-120521: clarify except* documentation to allow tuples (#120523)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
2024-06-19 18:49:00 +00:00
Irit Katriel d484383861
gh-119786: move locations doc to InternalDocs (#120445) 2024-06-19 17:58:54 +01:00
Mark Shannon d1c673b658
GH-120097: Make FrameLocalsProxy a mapping (#120101)
* Register FrameLocalsProxy as a subclass of collections.abc.Mapping

* Allow FrameLocalsProxy to matching mapping patterns
2024-06-19 17:54:13 +01:00
Mark Shannon 00257c746c
GH-119462: Enforce invariants of type versioning (GH-120731)
* Remove uses of Py_TPFLAGS_VALID_VERSION_TAG
2024-06-19 17:38:45 +01:00
Nadeshiko Manju f385d99f57
gh-120437: Fix `_CHECK_STACK_SPACE` optimization problems introduced in gh-118322 (GH-120712)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
2024-06-19 23:34:39 +08:00
yf-yang ace2045ea6
Fix types in pegen parser generator (GH-120720) 2024-06-19 16:12:40 +02:00
Irit Katriel eaaf6995a8
gh-120733: rename internal compiler functions according to naming convention (#120734) 2024-06-19 14:19:59 +01:00
Victor Stinner 0f3e36454d
gh-120635: Avoid leaking processes in test_pyrepl (#120676)
If the child process takes longer than SHORT_TIMEOUT seconds to
complete, kill the process but then wait until it completes with no
timeout to not leak child processes.
2024-06-19 15:14:29 +02:00
Jelle Zijlstra d8f27cb114
gh-120722: Set position on RETURN_VALUE in lambda (#120724) 2024-06-19 05:56:36 -07:00
Awbert a86e6255c3
gh-119960: Add information about regex flags in re module functions (#119978) 2024-06-19 09:42:01 +00:00
Kirill Podoprigora b8fb369193
gh-102797: Add more code snippets in test_ast (#102798)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Nineteendo <nineteendo19d0@gmail.com>
2024-06-19 09:51:43 +02:00
Kirill Podoprigora a816cd67f4
gh-120726: Fix compiler warnings on is_core_module() (#120727)
Fix compiler warnings on is_core_module() and
check_interpreter_whence(): only define them when
assertions are built.
2024-06-19 07:46:04 +00:00
Petr Viktorin 45d5cab533
Add a link to free-threading HOWTO to the index (follow-up to GH-119366) (GH-120703) 2024-06-19 09:17:26 +02:00
Wulian233 89f7208f67
gh-120633: Move scrollbar and remove tear-off menus in turtledemo (#120634)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2024-06-19 02:20:54 -04:00
Diego Russo a0dce37895
GH-119726: Deduplicate JIT trampolines for out-of-range jumps (GH-120250) 2024-06-18 18:27:02 -07:00