Skip to content

Commit 055e113

Browse files
authored
Merge branch 'main' into shutil_unpack_archive_false_positives
2 parents 4ece8c1 + 6f09f69 commit 055e113

File tree

83 files changed

+2294
-550
lines changed

Some content is hidden

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

83 files changed

+2294
-550
lines changed

Doc/glossary.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,11 @@ Glossary
11381138
an :term:`expression` or one of several constructs with a keyword, such
11391139
as :keyword:`if`, :keyword:`while` or :keyword:`for`.
11401140

1141+
static type checker
1142+
An external tool that reads Python code and analyzes it, looking for
1143+
issues such as incorrect types. See also :term:`type hints <type hint>`
1144+
and the :mod:`typing` module.
1145+
11411146
strong reference
11421147
In Python's C API, a strong reference is a reference to an object
11431148
which is owned by the code holding the reference. The strong
@@ -1214,8 +1219,8 @@ Glossary
12141219
attribute, or a function parameter or return value.
12151220

12161221
Type hints are optional and are not enforced by Python but
1217-
they are useful to static type analysis tools, and aid IDEs with code
1218-
completion and refactoring.
1222+
they are useful to :term:`static type checkers <static type checker>`.
1223+
They can also aid IDEs with code completion and refactoring.
12191224

12201225
Type hints of global variables, class attributes, and functions,
12211226
but not local variables, can be accessed using

Doc/howto/pyporting.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ are:
3939
#. Once your dependencies are no longer blocking you, use continuous integration
4040
to make sure you stay compatible with Python 2 and 3 (tox_ can help test
4141
against multiple versions of Python; ``python -m pip install tox``)
42-
#. Consider using optional static type checking to make sure your type usage
42+
#. Consider using optional :term:`static type checking <static type checker>`
43+
to make sure your type usage
4344
works in both Python 2 and 3 (e.g. use mypy_ to check your typing under both
4445
Python 2 and Python 3; ``python -m pip install mypy``).
4546

@@ -395,7 +396,7 @@ comparisons occur, making the mistake much easier to track down.
395396
Consider using optional static type checking
396397
--------------------------------------------
397398

398-
Another way to help port your code is to use a static type checker like
399+
Another way to help port your code is to use a :term:`static type checker` like
399400
mypy_ or pytype_ on your code. These tools can be used to analyze your code as
400401
if it's being run under Python 2, then you can run the tool a second time as if
401402
your code is running under Python 3. By running a static type checker twice like

Doc/library/asyncio-eventloop.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ Creating network servers
778778
*, sock=None, backlog=100, ssl=None, \
779779
ssl_handshake_timeout=None, \
780780
ssl_shutdown_timeout=None, \
781-
start_serving=True)
781+
start_serving=True, cleanup_socket=True)
782782
783783
Similar to :meth:`loop.create_server` but works with the
784784
:py:const:`~socket.AF_UNIX` socket family.
@@ -788,6 +788,10 @@ Creating network servers
788788
:class:`str`, :class:`bytes`, and :class:`~pathlib.Path` paths
789789
are supported.
790790

791+
If *cleanup_socket* is True then the Unix socket will automatically
792+
be removed from the filesystem when the server is closed, unless the
793+
socket has been replaced after the server has been created.
794+
791795
See the documentation of the :meth:`loop.create_server` method
792796
for information about arguments to this method.
793797

@@ -802,6 +806,10 @@ Creating network servers
802806

803807
Added the *ssl_shutdown_timeout* parameter.
804808

809+
.. versionchanged:: 3.13
810+
811+
Added the *cleanup_socket* parameter.
812+
805813

806814
.. coroutinemethod:: loop.connect_accepted_socket(protocol_factory, \
807815
sock, *, ssl=None, ssl_handshake_timeout=None, \

Doc/library/datetime.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ on efficient attribute extraction for output formatting and manipulation.
3838
Third-party library with expanded time zone and parsing support.
3939

4040
Package `DateType <https://pypi.org/project/datetype/>`_
41-
Third-party library that introduces distinct static types to e.g. allow static type checkers
41+
Third-party library that introduces distinct static types to e.g. allow
42+
:term:`static type checkers <static type checker>`
4243
to differentiate between naive and aware datetimes.
4344

4445
.. _datetime-naive-aware:

Doc/library/mmap.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@ To map anonymous memory, -1 should be passed as the fileno along with the length
285285
values are ``os.SEEK_CUR`` or ``1`` (seek relative to the current
286286
position) and ``os.SEEK_END`` or ``2`` (seek relative to the file's end).
287287

288+
.. versionchanged:: 3.13
289+
Return the new absolute position instead of ``None``.
290+
291+
.. method:: seekable()
292+
293+
Return whether the file supports seeking, and the return value is always ``True``.
294+
295+
.. versionadded:: 3.13
288296

289297
.. method:: size()
290298

Doc/library/tkinter.ttk.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,8 +1391,7 @@ option. If you don't know the class name of a widget, use the method
13911391
.. method:: element_create(elementname, etype, *args, **kw)
13921392

13931393
Create a new element in the current theme, of the given *etype* which is
1394-
expected to be either "image", "from" or "vsapi". The latter is only
1395-
available in Tk 8.6a for Windows XP and Vista and is not described here.
1394+
expected to be either "image" or "from".
13961395

13971396
If "image" is used, *args* should contain the default image name followed
13981397
by statespec/value pairs (this is the imagespec), and *kw* may have the
@@ -1418,13 +1417,28 @@ option. If you don't know the class name of a widget, use the method
14181417
Specifies a minimum width for the element. If less than zero, the
14191418
base image's width is used as a default.
14201419

1420+
Example::
1421+
1422+
img1 = tkinter.PhotoImage(master=root, file='button.png')
1423+
img1 = tkinter.PhotoImage(master=root, file='button-pressed.png')
1424+
img1 = tkinter.PhotoImage(master=root, file='button-active.png')
1425+
style = ttk.Style(root)
1426+
style.element_create('Button.button', 'image',
1427+
img1, ('pressed', img2), ('active', img3),
1428+
border=(2, 4), sticky='we')
1429+
14211430
If "from" is used as the value of *etype*,
14221431
:meth:`element_create` will clone an existing
14231432
element. *args* is expected to contain a themename, from which
14241433
the element will be cloned, and optionally an element to clone from.
14251434
If this element to clone from is not specified, an empty element will
14261435
be used. *kw* is discarded.
14271436

1437+
Example::
1438+
1439+
style = ttk.Style(root)
1440+
style.element_create('plain.background', 'from', 'default')
1441+
14281442

14291443
.. method:: element_names()
14301444

Doc/library/typing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
.. note::
1919

2020
The Python runtime does not enforce function and variable type annotations.
21-
They can be used by third party tools such as type checkers, IDEs, linters,
22-
etc.
21+
They can be used by third party tools such as :term:`type checkers <static type checker>`,
22+
IDEs, linters, etc.
2323

2424
--------------
2525

Doc/tutorial/stdlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ The :mod:`random` module provides tools for making random selections::
153153
'apple'
154154
>>> random.sample(range(100), 10) # sampling without replacement
155155
[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]
156-
>>> random.random() # random float
156+
>>> random.random() # random float from the interval [0.0, 1.0)
157157
0.17970987693706186
158158
>>> random.randrange(6) # random integer chosen from range(6)
159159
4

Doc/whatsnew/3.13.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,13 @@ array
149149
It can be used instead of ``'u'`` type code, which is deprecated.
150150
(Contributed by Inada Naoki in :gh:`80480`.)
151151

152+
asyncio
153+
-------
154+
155+
* :meth:`asyncio.loop.create_unix_server` will now automatically remove
156+
the Unix socket when the server is closed.
157+
(Contributed by Pierre Ossman in :gh:`111246`.)
158+
152159
copy
153160
----
154161

@@ -191,6 +198,14 @@ ipaddress
191198
* Add the :attr:`ipaddress.IPv4Address.ipv6_mapped` property, which returns the IPv4-mapped IPv6 address.
192199
(Contributed by Charles Machalow in :gh:`109466`.)
193200

201+
mmap
202+
----
203+
204+
* The :class:`mmap.mmap` class now has an :meth:`~mmap.mmap.seekable` method
205+
that can be used where it requires a file-like object with seekable and
206+
the :meth:`~mmap.mmap.seek` method return the new absolute position.
207+
(Contributed by Donghee Na and Sylvie Liberman in :gh:`111835`.)
208+
194209
opcode
195210
------
196211

Include/cpython/optimizer.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ typedef int (*optimize_func)(_PyOptimizerObject* self, PyCodeObject *code, _Py_C
4545
typedef struct _PyOptimizerObject {
4646
PyObject_HEAD
4747
optimize_func optimize;
48+
/* These thresholds are treated as signed so do not exceed INT16_MAX
49+
* Use INT16_MAX to indicate that the optimizer should never be called */
4850
uint16_t resume_threshold;
4951
uint16_t backedge_threshold;
5052
/* Data needed by the optimizer goes here, but is opaque to the VM */
@@ -76,6 +78,8 @@ PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewCounter(void);
7678
PyAPI_FUNC(PyObject *)PyUnstable_Optimizer_NewUOpOptimizer(void);
7779

7880
#define OPTIMIZER_BITS_IN_COUNTER 4
81+
/* Minimum of 16 additional executions before retry */
82+
#define MINIMUM_TIER2_BACKOFF 4
7983

8084
#ifdef __cplusplus
8185
}

0 commit comments

Comments
 (0)