Skip to content

Commit 9048d40

Browse files
committed
Merge branch 'master' into move-fractions-internal-docs
2 parents 52b42b2 + b8d2f65 commit 9048d40

65 files changed

Lines changed: 1089 additions & 577 deletions

Some content is hidden

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

‎Doc/library/platform.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Android platform
325325

326326
* ``release`` - Android version, as a string (e.g. ``"14"``).
327327

328-
* ``api_level`` - API level of the running device, as an integer (e.g. ``34``
328+
* ``api_level`` - Major component of the API level, as an integer (e.g. ``34``
329329
for Android 14). To get the API level which Python was built against, see
330330
:func:`sys.getandroidapilevel`.
331331

‎Doc/library/sys.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -862,9 +862,9 @@ always available. Unless explicitly noted otherwise, all variables are read-only
862862

863863
.. function:: getandroidapilevel()
864864

865-
Return the build-time API level of Android as an integer. This represents the
866-
minimum version of Android this build of Python can run on. For runtime
867-
version information, see :func:`platform.android_ver`.
865+
Return the major component of the Android API level that Python was built
866+
against, as an integer. For runtime version information, see
867+
:func:`platform.android_ver`.
868868

869869
.. availability:: Android.
870870

‎Doc/library/tkinter.rst‎

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6845,6 +6845,17 @@ and :mod:`!tkinter.constants` namespaces.
68456845
edges) plus ``CENTER`` (``'center'``), used as values for the *anchor* and
68466846
*sticky* options and by methods such as :meth:`Misc.grid_anchor`.
68476847

6848+
.. data:: EN
6849+
ES
6850+
WN
6851+
WS
6852+
6853+
Additional values for the *labelanchor* option of :class:`LabelFrame`
6854+
and :class:`ttk.LabelFrame <tkinter.ttk.LabelFrame>`,
6855+
which also accept the compass directions above.
6856+
6857+
.. versionadded:: next
6858+
68486859
.. data:: LEFT
68496860
RIGHT
68506861
TOP
@@ -6881,6 +6892,13 @@ and :mod:`!tkinter.constants` namespaces.
68816892
Values for the *wrap* option of the :class:`Text` widget, selecting line
68826893
wrapping on character or word boundaries.
68836894

6895+
.. data:: TABULAR
6896+
WORDPROCESSOR
6897+
6898+
Values for the *tabstyle* option of the :class:`Text` widget.
6899+
6900+
.. versionadded:: next
6901+
68846902
.. data:: BASELINE
68856903

68866904
The text-alignment value ``'baseline'``.
@@ -6891,6 +6909,12 @@ and :mod:`!tkinter.constants` namespaces.
68916909
Values for the *bordermode* option of the placer (see
68926910
:meth:`Place.place_configure`).
68936911

6912+
.. data:: IGNORE
6913+
6914+
An additional value for the *bordermode* option of the placer.
6915+
6916+
.. versionadded:: next
6917+
68946918
.. data:: INSERT
68956919
CURRENT
68966920
END
@@ -6916,6 +6940,38 @@ and :mod:`!tkinter.constants` namespaces.
69166940

69176941
Values for the *state* option of various widgets and items.
69186942

6943+
.. data:: READONLY
6944+
6945+
An additional value for the *state* option of :class:`Entry`,
6946+
:class:`Spinbox` and the themed widgets.
6947+
6948+
.. versionadded:: next
6949+
6950+
.. data:: ALTERNATE
6951+
BACKGROUND
6952+
FOCUS
6953+
HOVER
6954+
INVALID
6955+
PRESSED
6956+
SELECTED
6957+
6958+
Names of the themed widget states
6959+
(see :meth:`ttk.Widget.state <tkinter.ttk.Widget.state>`),
6960+
in addition to ``ACTIVE``, ``DISABLED`` and ``READONLY``.
6961+
6962+
.. versionadded:: next
6963+
6964+
.. data:: LEAF
6965+
OPEN
6966+
6967+
Names of the themed widget states used by
6968+
:class:`ttk.Treeview <tkinter.ttk.Treeview>`,
6969+
as are ``FIRST`` and ``LAST`` for the tabs of
6970+
:class:`ttk.Notebook <tkinter.ttk.Notebook>`.
6971+
They require Tk 9.1 or newer.
6972+
6973+
.. versionadded:: next
6974+
69196975
.. data:: CASCADE
69206976
CHECKBUTTON
69216977
COMMAND
@@ -6925,13 +6981,38 @@ and :mod:`!tkinter.constants` namespaces.
69256981
Menu entry types, used as the *itemType* argument of :meth:`Menu.add` and
69266982
:meth:`Menu.insert`.
69276983

6984+
.. data:: MENUBAR
6985+
TEAROFF
6986+
6987+
Values for the *type* option of the :class:`Menu` widget,
6988+
in addition to ``NORMAL``.
6989+
6990+
.. versionadded:: next
6991+
69286992
.. data:: SINGLE
69296993
BROWSE
69306994
MULTIPLE
69316995
EXTENDED
69326996

69336997
Values for the *selectmode* option of the :class:`Listbox` widget.
69346998

6999+
.. data:: ITEM
7000+
CELL
7001+
7002+
Values for the *selecttype* option of
7003+
:class:`ttk.Treeview <tkinter.ttk.Treeview>`.
7004+
It requires Tk 9.0 or newer.
7005+
7006+
.. versionadded:: next
7007+
7008+
.. data:: TREE
7009+
HEADINGS
7010+
7011+
Values for the *show* option of
7012+
:class:`ttk.Treeview <tkinter.ttk.Treeview>`.
7013+
7014+
.. versionadded:: next
7015+
69357016
.. data:: PIESLICE
69367017
CHORD
69377018
ARC
@@ -6966,6 +7047,74 @@ and :mod:`!tkinter.constants` namespaces.
69667047
Values for the *what* argument of :meth:`XView.xview_scroll` and
69677048
:meth:`YView.yview_scroll`.
69687049

7050+
.. data:: PIXELS
7051+
7052+
An additional value for the *what* argument of
7053+
:meth:`YView.yview_scroll` of the :class:`Text` widget.
7054+
7055+
.. versionadded:: next
7056+
7057+
.. data:: TEXT
7058+
IMAGE
7059+
7060+
Values for the *compound* option of the themed widgets,
7061+
in addition to ``CENTER``, ``LEFT``, ``RIGHT``, ``TOP``, ``BOTTOM``
7062+
and ``NONE``.
7063+
7064+
.. versionadded:: next
7065+
7066+
.. data:: ABOVE
7067+
BELOW
7068+
FLUSH
7069+
7070+
Values for the *direction* option of :class:`Menubutton` and
7071+
:class:`ttk.Menubutton <tkinter.ttk.Menubutton>`,
7072+
in addition to ``LEFT`` and ``RIGHT``.
7073+
7074+
.. versionadded:: next
7075+
7076+
.. data:: ALWAYS
7077+
MIDDLE
7078+
NEVER
7079+
7080+
Values for the *stretch* option of :meth:`PanedWindow.paneconfigure`,
7081+
in addition to ``FIRST`` and ``LAST``.
7082+
7083+
.. versionadded:: next
7084+
7085+
.. data:: DETERMINATE
7086+
INDETERMINATE
7087+
7088+
Values for the *mode* option of
7089+
:class:`ttk.Progressbar <tkinter.ttk.Progressbar>`.
7090+
7091+
.. versionadded:: next
7092+
7093+
.. data:: HOLLOW
7094+
7095+
An additional value for the *insertunfocussed* option of the
7096+
:class:`Text` widget, which also accepts ``NONE`` and ``SOLID``.
7097+
The option requires Tk 8.6 or newer.
7098+
7099+
.. versionadded:: next
7100+
7101+
.. data:: KEY
7102+
FOCUSIN
7103+
FOCUSOUT
7104+
7105+
Values for the *validate* option of :class:`Entry`, :class:`Spinbox`
7106+
and :class:`ttk.Entry <tkinter.ttk.Entry>`,
7107+
in addition to ``ALL``, ``FOCUS`` and ``NONE``.
7108+
7109+
.. versionadded:: next
7110+
7111+
.. data:: FORCED
7112+
7113+
An additional validation reason reported by the ``%V`` substitution
7114+
of the *validatecommand* option.
7115+
7116+
.. versionadded:: next
7117+
69697118
.. data:: UNDERLINE
69707119
NUMERIC
69717120
DOTBOX

‎Doc/library/urllib.error.rst‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
The :mod:`!urllib.error` module defines the exception classes for exceptions
1212
raised by :mod:`urllib.request`. The base exception class is :exc:`URLError`.
1313

14-
The following exceptions are raised by :mod:`!urllib.error` as appropriate:
15-
1614
.. exception:: URLError
1715

1816
The handlers raise this exception (or derived exceptions) when they run into

‎Doc/library/urllib.request.rst‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ The following classes are provided:
422422
received the request is re-sent with the authentication credentials. If
423423
authentication succeeds, ``update_authenticated`` is called to set
424424
``is_authenticated`` ``True`` for the URI, so that subsequent requests to
425-
the URI or any of its super-URIs will automatically include the
425+
the URI itself or any path below it will automatically include the
426426
authentication credentials.
427427

428428
.. versionadded:: 3.5
@@ -855,7 +855,7 @@ The following attribute and methods should only be used by classes derived from
855855

856856
1. a :class:`Request` object,
857857
#. a file-like object with the HTTP error body,
858-
#. the three-digit code of the error, as a string,
858+
#. the three-digit code of the error, as an integer,
859859
#. the user-visible explanation of the code, as a string, and
860860
#. the headers of the error, as a mapping object.
861861

@@ -1009,11 +1009,10 @@ These methods are available on :class:`HTTPPasswordMgr` and
10091009
.. method:: HTTPPasswordMgr.add_password(realm, uri, user, passwd)
10101010

10111011
*uri* can be either a single URI, or a sequence of URIs. *realm*, *user* and
1012-
*passwd* must be strings. This causes ``(user, passwd)`` to be used as
1013-
authentication tokens when authentication for *realm* and a super-URI of any
1014-
of the given URIs is given. If a URI includes a scheme, its credentials only
1015-
match authentication URIs with the same scheme or no scheme. A URI without a
1016-
scheme matches authentication URIs with any scheme.
1012+
*passwd* must be strings. The credentials for *realm* apply to any registered
1013+
URI and to paths below it. If a URI includes a scheme,
1014+
its credentials only match authentication URIs with the same scheme or no
1015+
scheme. A URI without a scheme matches authentication URIs with any scheme.
10171016

10181017
.. versionchanged:: 3.16
10191018
Authentication credentials for URIs with a scheme are now scoped by
@@ -1229,8 +1228,9 @@ FTPHandler Objects
12291228

12301229
.. method:: FTPHandler.ftp_open(req)
12311230

1232-
Open the FTP file indicated by *req*. The login is always done with empty
1233-
username and password.
1231+
Open the FTP file indicated by *req*. The username and password are taken
1232+
from the URL, with missing values defaulting to empty strings. See
1233+
:meth:`ftplib.FTP.login` for the login defaults.
12341234

12351235

12361236
.. _cacheftp-handler-objects:
@@ -1272,9 +1272,9 @@ HTTPErrorProcessor Objects
12721272

12731273
Process HTTP error responses.
12741274

1275-
For 200 error codes, the response object is returned immediately.
1275+
For 2xx status codes, the response object is returned immediately.
12761276

1277-
For non-200 error codes, this simply passes the job on to the
1277+
For other status codes, this simply passes the job on to the
12781278
:meth:`!http_error_\<type\>` handler methods, via :meth:`OpenerDirector.error`.
12791279
Eventually, :class:`HTTPDefaultErrorHandler` will raise an
12801280
:exc:`~urllib.error.HTTPError` if no other handler handles the error.
@@ -1308,11 +1308,11 @@ it::
13081308
... data = gzip.decompress(data)
13091309
... print(data[:300].decode('utf-8', errors='replace'))
13101310

1311-
Note that urlopen returns a bytes object. This is because there is no way
1312-
for urlopen to automatically determine the encoding of the byte stream
1313-
it receives from the HTTP server. In general, a program will decode
1314-
the returned bytes object to string once it determines or guesses
1315-
the appropriate encoding.
1311+
Note that calling ``read()`` on the response returned by :func:`urlopen` returns
1312+
a :class:`bytes` object. This is because there is no way for :func:`urlopen` to
1313+
automatically determine the encoding of the byte stream it receives from the
1314+
HTTP server. In general, a program will decode the returned bytes object to a
1315+
string once it determines or guesses the appropriate encoding.
13161316

13171317
The following HTML spec document, https://html.spec.whatwg.org/#charset, lists
13181318
the various ways in which an HTML or an XML document could have specified its
@@ -1511,7 +1511,7 @@ The following example uses an explicitly specified HTTP proxy, overriding
15111511
environment settings::
15121512

15131513
>>> import urllib.request
1514-
>>> proxies = {'http': 'http://proxy.example.com:8080/'}
1514+
>>> proxies = {'https': 'http://proxy.example.com:8080/'}
15151515
>>> opener = urllib.request.build_opener(urllib.request.ProxyHandler(proxies))
15161516
>>> with opener.open("https://www.python.org") as f:
15171517
... f.read().decode('utf-8')
@@ -1660,7 +1660,8 @@ The typical response object is a :class:`urllib.response.addinfourl` instance:
16601660

16611661
.. attribute:: headers
16621662

1663-
Returns the headers of the response in the form of an :class:`~email.message.EmailMessage` instance.
1663+
Returns the headers of the response in the form of an
1664+
:class:`~email.message.Message` instance.
16641665

16651666
.. attribute:: status
16661667

‎Doc/whatsnew/3.16.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,14 @@ tkinter
972972
with no unit suffix to :class:`int` or :class:`float`.
973973
(Contributed by Serhiy Storchaka in :gh:`153513`.)
974974

975+
* Added symbolic constants for Tk option values which were missing in
976+
:mod:`!tkinter.constants`: values for the *labelanchor*, *compound*,
977+
*bordermode*, *direction*, *stretch*, *tabstyle*, *insertunfocussed*,
978+
*mode*, *selecttype*, *show*, *state*, *validate* and *type* options,
979+
the names of the themed widget states, and ``PIXELS`` for scrolling
980+
the :class:`~tkinter.Text` widget.
981+
(Contributed by Serhiy Storchaka in :gh:`159301`.)
982+
975983

976984
turtle
977985
------

‎Include/Python.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
//
3636
// The <ctype.h> and <unistd.h> headers are not included by limited C API
3737
// version 3.13 and newer.
38-
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030b0000
38+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < _Py_PACK_VERSION(3, 11)
3939
# include <errno.h> // errno
4040
# include <stdio.h> // FILE*
4141
# include <stdlib.h> // getenv()
4242
#endif
43-
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < 0x030d0000
43+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 < _Py_PACK_VERSION(3, 13)
4444
# include <ctype.h> // tolower()
4545
# ifndef MS_WINDOWS
4646
# include <unistd.h> // close()

0 commit comments

Comments
 (0)