Skip to content

Commit 2d4ffda

Browse files
authored
Merge branch 'main' into fix/venv-powershell-literal-paths
2 parents 1c2557e + e5ef47e commit 2d4ffda

50 files changed

Lines changed: 800 additions & 258 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Doc/c-api/function.rst‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ There are a few functions specific to Python functions.
1414
1515
The C structure used for functions.
1616

17+
In the free-threaded build, direct access to mutable fields requires
18+
synchronization if another thread may modify the function. See
19+
:ref:`freethreading-extensions-howto`.
20+
1721

1822
.. c:var:: PyTypeObject PyFunction_Type
1923
@@ -71,6 +75,11 @@ There are a few functions specific to Python functions.
7175
This is normally a :class:`string <str>` containing the module name,
7276
but can be set to any other object by Python code.
7377
78+
In the free-threaded build, if the attribute may be modified concurrently,
79+
convert the borrowed reference to a strong reference with :c:func:`Py_XNewRef`
80+
immediately, before calling any other Python API. The same applies to
81+
:c:func:`PyFunction_GET_MODULE`.
82+
7483
7584
.. c:function:: PyObject* PyFunction_GetDefaults(PyObject *op)
7685

‎Doc/c-api/init_config.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,10 @@ PyConfig
14391439
14401440
See also the :c:member:`~PyConfig.filesystem_errors` member.
14411441
1442+
See also :c:func:`PyUnicode_EncodeFSDefault` and
1443+
:ref:`related functions <capi-filesystem-encoding>`
1444+
for encoding paths at runtime.
1445+
14421446
.. c:member:: wchar_t* filesystem_errors
14431447
14441448
:term:`Filesystem error handler <filesystem encoding and error handler>`:

‎Doc/c-api/interp-lifecycle.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ Process-wide parameters
514514
Return the version of this Python interpreter. This is a string that looks
515515
something like ::
516516
517-
"3.15.0rc2 (3.15.0~rc2-1.fc44.x86_64, Sep 3 2026, 00:00:00) [GCC 16.2.1 20260819 (Red Hat 16.2.1-2)]"
517+
"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \n[GCC 4.2.3]"
518518
519519
.. index:: single: version (in module sys)
520520

‎Doc/c-api/reflection.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ Reflection
9696
Return the name of *func* if it is a function, class or instance object, else the
9797
name of *func*\s type.
9898
99+
For a Python function or method, the returned pointer refers to the
100+
function's name and must not be retained across operations that may change
101+
that name. In the free-threaded build, copy the string before detaching
102+
the thread state or executing Python code if the name may be modified
103+
concurrently.
104+
99105
100106
.. c:function:: const char* PyEval_GetFuncDesc(PyObject *func)
101107

‎Doc/c-api/unicode.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,8 @@ system.
812812
used for ``strict``.
813813
814814
815+
.. _capi-filesystem-encoding:
816+
815817
File System Encoding
816818
""""""""""""""""""""
817819

‎Doc/library/calendar.rst‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
169169
the specified width, representing an empty day. The *weekday* parameter
170170
is unused.
171171

172-
.. method:: formatweek(theweek, w=0)
172+
.. method:: formatweek(theweek, width)
173173

174-
Return a single week in a string with no newline. If *w* is provided, it
175-
specifies the width of the date columns, which are centered. Depends
174+
Return a single week in a string with no newline. *width* specifies
175+
the width of the date columns, which are centered. Depends
176176
on the first weekday as specified in the constructor or set by the
177177
:meth:`setfirstweekday` method.
178178

@@ -200,7 +200,7 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is
200200
:meth:`setfirstweekday` method.
201201

202202

203-
.. method:: formatmonthname(theyear, themonth, width=0, withyear=True)
203+
.. method:: formatmonthname(theyear, themonth, width, withyear=True)
204204

205205
Return a string representing the month's name centered within the
206206
specified *width*. If *withyear* is ``True``, include the year in the

‎Doc/library/test.rst‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,13 @@ test suite, thanks to the :option:`-m` option: :program:`python -m test`. Under
165165
the hood, it uses :mod:`!test.regrtest`; the call :program:`python -m
166166
test.regrtest` used in previous Python versions still works. Running the
167167
script by itself automatically starts running all regression tests in the
168-
:mod:`!test` package. It does this by finding all modules in the package whose
169-
name starts with ``test_``, importing them, and executing the function
170-
:func:`test_main` if present or loading the tests via
171-
unittest.TestLoader.loadTestsFromModule if ``test_main`` does not exist. The
172-
names of tests to execute may also be passed to the script. Specifying a single
168+
:mod:`!test` package. It does this by finding modules and packages whose names
169+
start with ``test_``, importing each one, and loading its tests with
170+
:meth:`unittest.TestLoader.loadTestsFromModule`. See the
171+
:ref:`load_tests protocol <load_tests-protocol>` for how a module or package
172+
can customize what is loaded. Defining a module-level ``test_main()`` function
173+
is not supported and causes the test to fail. The names of tests to
174+
execute may also be passed to the script. Specifying a single
173175
regression test (:program:`python -m test test_spam`) will minimize output and
174176
only print whether the test passed or failed.
175177

@@ -882,9 +884,11 @@ The :mod:`!test.support` module defines the following functions:
882884

883885
.. function:: reap_children()
884886

885-
Use this at the end of ``test_main`` whenever sub-processes are started.
886-
This will help ensure that no extra children (zombies) stick around to
887-
hog resources and create problems when looking for refleaks.
887+
Call this from :meth:`~unittest.TestCase.setUp`,
888+
:meth:`~unittest.TestCase.tearDown`, or ``tearDownModule()`` in tests
889+
that start subprocesses. This will help ensure that no extra children
890+
(zombies) stick around to hog resources and create problems when looking
891+
for refleaks.
888892

889893

890894
.. function:: get_attribute(obj, name)

‎Doc/library/tkinter.rst‎

Lines changed: 102 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -773,34 +773,76 @@ Tk option data types
773773

774774
Many widget options documented in the reference
775775
accept values of a small number of common types, described here.
776+
The standard options and their types are described in the
777+
:manpage:`options(3tk)` manual page.
776778

777779
anchor
778780
Legal values are points of the compass: ``"n"``, ``"ne"``, ``"e"``, ``"se"``,
779781
``"s"``, ``"sw"``, ``"w"``, ``"nw"``, and also ``"center"``.
782+
The *labelanchor* option of :class:`LabelFrame` and
783+
:class:`ttk.LabelFrame <tkinter.ttk.LabelFrame>`
784+
accepts also ``"en"``, ``"es"``, ``"wn"`` and ``"ws"``.
785+
The *sticky* option of the grid geometry manager accepts a combination
786+
of the compass directions, such as ``"nsew"``, or an empty string.
780787

781788
bitmap
782789
There are ten built-in, named bitmaps: ``'error'``, ``'gray12'``,
783790
``'gray25'``, ``'gray50'``, ``'gray75'``, ``'hourglass'``, ``'info'``,
784-
``'questhead'``, ``'question'``, ``'warning'``. To specify an X bitmap
785-
filename, give the full path to the file, preceded with an ``@``, as in
786-
``"@/usr/contrib/bitmap/gumby.bit"``.
791+
``'questhead'``, ``'question'``, ``'warning'``.
792+
On macOS the following bitmaps are available as well:
793+
``'application'``, ``'accessory'``, ``'folder'``, ``'pfolder'``,
794+
``'trash'``, ``'floppy'``, ``'ramdisk'``, ``'cdrom'``, ``'preferences'``,
795+
``'querydoc'``, ``'stop'``, ``'note'`` and ``'caution'``.
796+
To specify an X bitmap file, give the full path to the file,
797+
preceded with an ``@``, as in ``"@/usr/contrib/bitmap/gumby.bit"``.
787798

788799
boolean
789-
You can pass integers 0 or 1 or the strings ``"yes"`` or ``"no"``.
800+
You can pass the integers 0 or 1, ``True`` or ``False``, or the strings
801+
``"0"``, ``"1"``, ``"yes"``, ``"no"``, ``"true"``, ``"false"``, ``"on"``
802+
or ``"off"``.
803+
The strings are matched ignoring case,
804+
and an unambiguous prefix, such as ``"t"``, is enough.
805+
Any non-zero integer means true.
790806

791807
callback
792-
This is any Python function that takes no arguments. For example::
808+
This is any callable object.
809+
Most callbacks take no arguments. For example::
793810

794811
def print_it():
795812
print("hi there")
796813
fred["command"] = print_it
797814

815+
Some options call it with arguments,
816+
such as the *command* option of :class:`Scale`,
817+
which is called with the new value.
818+
798819
color
799-
Colors can be given as the names of X colors in the rgb.txt file, or as strings
800-
representing RGB values in 4 bit: ``"#RGB"``, 8 bit: ``"#RRGGBB"``, 12 bit:
801-
``"#RRRGGGBBB"``, or 16 bit: ``"#RRRRGGGGBBBB"`` ranges, where R,G,B here
802-
represent any legal hex digit. See the :manpage:`colors(3tk)` man page for
803-
the list of named colors.
820+
Colors can be given as symbolic names, such as ``"red"`` or ``"light blue"``,
821+
or as strings representing RGB values in 4 bit: ``"#RGB"``, 8 bit:
822+
``"#RRGGBB"``, 12 bit: ``"#RRRGGGBBB"``, or 16 bit: ``"#RRRRGGGGBBBB"``
823+
ranges, where R,G,B here represent any legal hex digit.
824+
Tk provides a portable set of symbolic names available on all platforms;
825+
they are matched ignoring case and spaces,
826+
so ``"light blue"``, ``"Light Blue"`` and ``"lightblue"``
827+
are the same color.
828+
The full list of names, including the platform-specific names
829+
of the current system colors
830+
(for example ``"systemButtonFace"`` on Windows
831+
or ``"systemWindowBody"`` on macOS),
832+
is given in the :manpage:`colors(3tk)` manual page.
833+
:meth:`~tkinter.Misc.winfo_rgb` returns
834+
the red, green and blue components of a color.
835+
836+
compound
837+
Determines how to combine an image and a text displayed in a widget.
838+
Legal values are ``"none"`` (display the image if there is one,
839+
otherwise the text), ``"text"``, ``"image"``,
840+
``"center"`` (display the text in the center of the image) and
841+
``"top"``, ``"bottom"``, ``"left"``, ``"right"``
842+
(display the image above, below, to the left of or to the right
843+
of the text).
844+
The themed widgets accept all these values,
845+
the classic widgets accept all except ``"text"`` and ``"image"``.
804846

805847
cursor
806848
The name of the mouse cursor to display while the pointer is over the widget.
@@ -836,19 +878,32 @@ font
836878
``(family, size, *styles)`` (or as the equivalent string
837879
``"Courier 10 bold"``). Font sizes with positive numbers are measured in
838880
points; sizes with negative numbers are measured in pixels.
839-
840-
geometry
841-
This is a string of the form ``widthxheight``, where width and height are
842-
measured in pixels for most widgets (in characters for widgets displaying text).
843-
For example: ``fred["geometry"] = "200x100"``.
881+
The name of a named font, such as ``"TkDefaultFont"``,
882+
a :class:`tkinter.font.Font` instance,
883+
or, on X11, an XLFD font name can be used as well.
844884

845885
justify
846886
Legal values are the strings: ``"left"``, ``"center"``, and ``"right"``.
847887

888+
orient
889+
Legal values are ``"horizontal"`` and ``"vertical"``.
890+
891+
padding
892+
This is a legal distance (see above), applied on all sides,
893+
or a sequence of up to four distances
894+
specifying the left, top, right and bottom padding.
895+
If fewer than four are specified,
896+
the bottom padding defaults to the top one,
897+
the right one to the left one, and the top one to the left one.
898+
It is only supported by the themed widgets.
899+
848900
region
849-
This is a string with four space-delimited elements, each of which is a legal
850-
distance (see above). For example: ``"2 3 4 5"`` and ``"3i 2i 4.5i 2i"`` and
851-
``"3c 2c 4c 10.43c"`` are all legal regions.
901+
Used for the *scrollregion* option of :class:`Canvas`.
902+
This is a string with four space-delimited elements,
903+
each of which is a legal distance (see above),
904+
or a sequence of four such elements.
905+
For example: ``"2 3 4 5"``, ``(2, 3, 4, 5)``, ``"3i 2i 4.5i 2i"`` and
906+
``"3c 2c 4c 10.43c"`` are all legal regions.
852907

853908
relief
854909
Determines what the border style of a widget will be. Legal values are:
@@ -859,8 +914,19 @@ scrollcommand
859914
This is almost always the :meth:`!set` method of some scrollbar widget, but can
860915
be any widget method that takes a single argument.
861916

917+
state
918+
Legal values are ``"normal"``, ``"disabled"`` and, depending on the widget,
919+
also ``"active"``, ``"hidden"`` (for :class:`Canvas` items)
920+
or ``"readonly"`` (for :class:`Entry`, :class:`Spinbox`
921+
and the themed widgets).
922+
The themed widgets have in addition a more general set of states,
923+
which is manipulated with
924+
:meth:`ttk.Widget.state <tkinter.ttk.Widget.state>`.
925+
862926
wrap
863-
Must be one of: ``"none"``, ``"char"``, or ``"word"``.
927+
Must be one of ``"none"``, ``"char"`` or ``"word"``
928+
for the :class:`Text` widget and its tags;
929+
for a tag an empty string means to use the widget's value.
864930

865931
.. _Bindings-and-Events:
866932

@@ -1110,7 +1176,7 @@ Base and mixin classes
11101176
Interpret the string *s* as a Tcl boolean and return the corresponding
11111177
:class:`bool`.
11121178
Tcl accepts values such as ``'1'``, ``'0'``, ``'yes'``, ``'no'``,
1113-
``'true'`` and ``'false'``.
1179+
``'true'``, ``'false'``, ``'on'`` and ``'off'``.
11141180
Raise :exc:`ValueError` if *s* is not a valid boolean.
11151181

11161182
.. method:: getdouble(s)
@@ -2143,6 +2209,9 @@ Base and mixin classes
21432209

21442210
Return the geometry of the widget, in the form ``widthxheight+x+y``.
21452211
All dimensions are in pixels.
2212+
The position is relative to the parent widget;
2213+
use :meth:`winfo_rootx` and :meth:`winfo_rooty`
2214+
for the position on the screen.
21462215
An offset can be negative; see :meth:`~Wm.geometry`.
21472216

21482217
.. method:: winfo_height()
@@ -3369,6 +3438,8 @@ Base and mixin classes
33693438
Shift the view left or right by *number* units.
33703439
*what* is either ``'units'`` or ``'pages'``; a negative *number* scrolls
33713440
left and a positive one scrolls right.
3441+
The :class:`Text` widget accepts also ``'pixels'``,
3442+
and then *number* can be a screen distance, such as ``'1i'``.
33723443

33733444

33743445
.. class:: YView()
@@ -3399,6 +3470,8 @@ Base and mixin classes
33993470
Shift the view up or down by *number* units.
34003471
*what* is either ``'units'`` or ``'pages'``; a negative *number* scrolls
34013472
up and a positive one scrolls down.
3473+
The :class:`Text` widget accepts also ``'pixels'``,
3474+
and then *number* can be a screen distance, such as ``'1i'``.
34023475

34033476

34043477
.. class:: BaseWidget(master, widgetName, cnf={}, kw={}, extra=())
@@ -3828,8 +3901,7 @@ Widget classes
38283901

38293902
.. note::
38303903

3831-
Tk 8.6 added the *angle* option and Tk 9.0 added the *underline*
3832-
option for ``text`` items.
3904+
Tk 8.6 added the *angle* option for ``text`` items.
38333905

38343906
.. method:: coords(tagOrId)
38353907
coords(tagOrId, coordList, /)
@@ -5226,10 +5298,10 @@ Widget classes
52265298
*increment* options, or an explicit list of strings given by the *values*
52275299
option (which takes precedence over the range).
52285300
Each time an arrow is invoked the *command* callback, if any, is called; the
5229-
*wrap* option controls whether stepping past either end of the range wraps
5230-
around to the other end; the *format* option specifies how numeric values
5231-
are formatted; and the *validate* option enables validation of the entered
5232-
text.
5301+
boolean *wrap* option controls whether stepping past either end of the range
5302+
wraps around to the other end;
5303+
the *format* option specifies how numeric values are formatted;
5304+
and the *validate* option enables validation of the entered text.
52335305
Inherits from :class:`Widget` and :class:`XView`.
52345306

52355307
With a non-integer *increment*, see :ref:`numeric values and the locale
@@ -5631,7 +5703,7 @@ Widget classes
56315703
baseline, for superscripts and subscripts.
56325704

56335705
*underline*
5634-
Whether to underline the text.
5706+
Whether to underline the text (a boolean).
56355707

56365708
*underlinefg*
56375709
The color of the underline; it defaults to the text color.
@@ -5789,7 +5861,8 @@ Widget classes
57895861
Embed a window (any widget) at *index*.
57905862
The options, given in *cnf* and *kw*, include *window* (the widget to
57915863
embed), *create* (a callback that creates the widget on demand), *align*,
5792-
*stretch*, *padx* and *pady*.
5864+
the boolean *stretch* (whether the widget is stretched vertically to the
5865+
height of the line), *padx* and *pady*.
57935866
The embedded widget must be a descendant of the text widget's parent.
57945867

57955868
.. method:: window_cget(index, option)
@@ -6665,7 +6738,7 @@ Module-level functions
66656738
Convert the Tcl boolean string *s* (one of ``'1'``, ``'true'``, ``'yes'``,
66666739
``'on'`` and similar, or their false counterparts) to a Python
66676740
:class:`bool`.
6668-
Raise :exc:`TclError` for an invalid value.
6741+
Raise :exc:`ValueError` for an invalid value.
66696742

66706743
.. function:: getdouble(s)
66716744

‎Doc/using/windows.rst‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ Passing ``--update`` will replace existing installs if the new version is newer.
283283
Otherwise, they will be left. If no tags are provided with ``--update``, all
284284
installs managed by the Python install manager will be updated if newer versions
285285
are available. Updates will remove any modifications made to the install,
286-
including globally installed packages, but virtual environments will continue to
287-
work.
286+
including globally installed packages, but will leave ``site-packages`` and
287+
``Scripts`` directories as is. Virtual environments are also unaffected.
288288

289289
Passing ``--dry-run`` will generate output and logs, but will not modify any
290290
installs.
@@ -399,8 +399,9 @@ override all other settings, but not every option is available.
399399
This section will describe the defaults, but be aware that modified or
400400
overridden installs may resolve settings differently.
401401

402-
A global configuration file may be configured by an administrator, and would be
403-
read first. The user configuration file is stored at
402+
A global configuration file may be configured by an
403+
:ref:`administrator <pymanager-admin-config>`
404+
and would be read first. The user configuration file is stored at
404405
:file:`%AppData%\\Python\\pymanager.json`
405406
(note that this location is under ``Roaming``, not ``Local``) and is read next,
406407
overwriting any settings from earlier files. An additional configuration file

0 commit comments

Comments
 (0)