Skip to content

Commit 37377e6

Browse files
committed
Merge branch 'main' into icompexc
* main: pythongh-108520: Fix bad fork detection in nested multiprocessing use case (python#108568) pythongh-108590: Revert pythongh-108657 (commit 400a1ce) (python#108686) pythongh-108494: Argument Clinic: Document how to generate code that uses the limited C API (python#108584) Document Python build requirements (python#108646) pythongh-101100: Fix Sphinx warnings in the Logging Cookbook (python#108678) Fix typo in multiprocessing docs (python#108666) pythongh-108669: unittest: Fix documentation for TestResult.collectedDurations (python#108670) pythongh-108590: Fix sqlite3.iterdump for invalid Unicode in TEXT columns (python#108657) Revert "pythongh-103224: Use the realpath of the Python executable in `test_venv` (pythonGH-103243)" (pythonGH-108667) pythongh-106320: Remove private _Py_ForgetReference() (python#108664) Mention Ellipsis pickling in the docs (python#103660) Revert "Use non alternate name for Kyiv (pythonGH-108533)" (pythonGH-108649) pythongh-108278: Deprecate passing the first param of sqlite3.Connection callback APIs by keyword (python#108632) pythongh-108455: peg_generator: install two stubs packages before running mypy (python#108637) pythongh-107801: Improve the accuracy of io.IOBase.seek docs (python#108268)
2 parents 8e8b41f + add8d45 commit 37377e6

29 files changed

+351
-72
lines changed

Doc/howto/clinic.rst

+22-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ process a single source file, like this:
158158
The CLI supports the following options:
159159

160160
.. program:: ./Tools/clinic/clinic.py [-h] [-f] [-o OUTPUT] [-v] \
161-
[--converters] [--make] [--srcdir SRCDIR] [FILE ...]
161+
[--converters] [--make] [--srcdir SRCDIR] [--limited] [FILE ...]
162162

163163
.. option:: -h, --help
164164

@@ -193,6 +193,11 @@ The CLI supports the following options:
193193
A file to exclude in :option:`--make` mode.
194194
This option can be given multiple times.
195195

196+
.. option:: --limited
197+
198+
Use the :ref:`Limited API <limited-c-api>` to parse arguments in the generated C code.
199+
See :ref:`clinic-howto-limited-capi`.
200+
196201
.. option:: FILE ...
197202

198203
The list of files to process.
@@ -1905,6 +1910,22 @@ blocks embedded in Python files look slightly different. They look like this:
19051910
#/*[python checksum:...]*/
19061911
19071912
1913+
.. _clinic-howto-limited-capi:
1914+
1915+
How to use the Limited C API
1916+
----------------------------
1917+
1918+
If Argument Clinic :term:`input` is located within a C source file
1919+
that contains ``#define Py_LIMITED_API``, Argument Clinic will generate C code
1920+
that uses the :ref:`Limited API <limited-c-api>` to parse arguments. The
1921+
advantage of this is that the generated code will not use private functions.
1922+
However, this *can* result in Argument Clinic generating less efficient code
1923+
in some cases. The extent of the performance penalty will depend
1924+
on the parameters (types, number, etc.).
1925+
1926+
.. versionadded:: 3.13
1927+
1928+
19081929
.. _clinic-howto-override-signature:
19091930

19101931
How to override the generated signature

Doc/howto/logging-cookbook.rst

+11-4
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ printed on the console; on the server side, you should see something like:
761761
762762
Note that there are some security issues with pickle in some scenarios. If
763763
these affect you, you can use an alternative serialization scheme by overriding
764-
the :meth:`~handlers.SocketHandler.makePickle` method and implementing your
764+
the :meth:`~SocketHandler.makePickle` method and implementing your
765765
alternative there, as well as adapting the above script to use your alternative
766766
serialization.
767767

@@ -835,6 +835,8 @@ To test these files, do the following in a POSIX environment:
835835
You may need to tweak the configuration files in the unlikely event that the
836836
configured ports clash with something else in your test environment.
837837

838+
.. currentmodule:: logging
839+
838840
.. _context-info:
839841

840842
Adding contextual information to your logging output
@@ -1546,7 +1548,7 @@ Sometimes you want to let a log file grow to a certain size, then open a new
15461548
file and log to that. You may want to keep a certain number of these files, and
15471549
when that many files have been created, rotate the files so that the number of
15481550
files and the size of the files both remain bounded. For this usage pattern, the
1549-
logging package provides a :class:`~handlers.RotatingFileHandler`::
1551+
logging package provides a :class:`RotatingFileHandler`::
15501552

15511553
import glob
15521554
import logging
@@ -1594,6 +1596,8 @@ and each time it reaches the size limit it is renamed with the suffix
15941596
Obviously this example sets the log length much too small as an extreme
15951597
example. You would want to set *maxBytes* to an appropriate value.
15961598

1599+
.. currentmodule:: logging
1600+
15971601
.. _format-styles:
15981602

15991603
Use of alternative formatting styles
@@ -1840,6 +1844,7 @@ However, it should be borne in mind that each link in the chain adds run-time
18401844
overhead to all logging operations, and the technique should only be used when
18411845
the use of a :class:`Filter` does not provide the desired result.
18421846

1847+
.. currentmodule:: logging.handlers
18431848

18441849
.. _zeromq-handlers:
18451850

@@ -1917,6 +1922,8 @@ of queues, for example a ZeroMQ 'subscribe' socket. Here's an example::
19171922
:ref:`A more advanced logging tutorial <logging-advanced-tutorial>`
19181923

19191924

1925+
.. currentmodule:: logging
1926+
19201927
An example dictionary-based configuration
19211928
-----------------------------------------
19221929

@@ -3918,8 +3925,8 @@ that in other languages such as Java and C#, loggers are often static class
39183925
attributes. However, this pattern doesn't make sense in Python, where the
39193926
module (and not the class) is the unit of software decomposition.
39203927

3921-
Adding handlers other than :class:`NullHandler` to a logger in a library
3922-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3928+
Adding handlers other than :class:`~logging.NullHandler` to a logger in a library
3929+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39233930

39243931
Configuring logging by adding handlers, formatters and filters is the
39253932
responsibility of the application developer, not the library developer. If you

Doc/library/io.rst

+14-12
Original file line numberDiff line numberDiff line change
@@ -403,20 +403,19 @@ I/O Base Classes
403403
Note that it's already possible to iterate on file objects using ``for
404404
line in file: ...`` without calling :meth:`!file.readlines`.
405405

406-
.. method:: seek(offset, whence=SEEK_SET, /)
406+
.. method:: seek(offset, whence=os.SEEK_SET, /)
407407

408-
Change the stream position to the given byte *offset*. *offset* is
409-
interpreted relative to the position indicated by *whence*. The default
410-
value for *whence* is :data:`!SEEK_SET`. Values for *whence* are:
408+
Change the stream position to the given byte *offset*,
409+
interpreted relative to the position indicated by *whence*,
410+
and return the new absolute position.
411+
Values for *whence* are:
411412

412-
* :data:`!SEEK_SET` or ``0`` -- start of the stream (the default);
413+
* :data:`os.SEEK_SET` or ``0`` -- start of the stream (the default);
413414
*offset* should be zero or positive
414-
* :data:`!SEEK_CUR` or ``1`` -- current stream position; *offset* may
415-
be negative
416-
* :data:`!SEEK_END` or ``2`` -- end of the stream; *offset* is usually
417-
negative
418-
419-
Return the new absolute position.
415+
* :data:`os.SEEK_CUR` or ``1`` -- current stream position;
416+
*offset* may be negative
417+
* :data:`os.SEEK_END` or ``2`` -- end of the stream;
418+
*offset* is usually negative
420419

421420
.. versionadded:: 3.1
422421
The :data:`!SEEK_*` constants.
@@ -1061,14 +1060,17 @@ Text I/O
10611060
Any other argument combinations are invalid,
10621061
and may raise exceptions.
10631062

1063+
.. seealso::
1064+
1065+
:data:`os.SEEK_SET`, :data:`os.SEEK_CUR`, and :data:`os.SEEK_END`.
1066+
10641067
.. method:: tell()
10651068

10661069
Return the stream position as an opaque number.
10671070
The return value of :meth:`!tell` can be given as input to :meth:`seek`,
10681071
to restore a previous stream position.
10691072

10701073

1071-
10721074
.. class:: StringIO(initial_value='', newline='\n')
10731075

10741076
A text stream using an in-memory text buffer. It inherits

Doc/library/multiprocessing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2988,7 +2988,7 @@ Global variables
29882988
Safe importing of main module
29892989

29902990
Make sure that the main module can be safely imported by a new Python
2991-
interpreter without causing unintended side effects (such a starting a new
2991+
interpreter without causing unintended side effects (such as starting a new
29922992
process).
29932993

29942994
For example, using the *spawn* or *forkserver* start method

Doc/library/pickle.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ What can be pickled and unpickled?
494494

495495
The following types can be pickled:
496496

497-
* ``None``, ``True``, and ``False``;
497+
* built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and
498+
``NotImplemented``);
498499

499500
* integers, floating-point numbers, complex numbers;
500501

Doc/library/sqlite3.rst

+21-6
Original file line numberDiff line numberDiff line change
@@ -763,10 +763,10 @@ Connection objects
763763
... print(row)
764764
('acbd18db4cc2f85cedef654fccc4a4d8',)
765765

766-
.. versionchanged:: 3.13
766+
.. versionchanged:: 3.13
767767

768-
Passing *name*, *narg*, and *func* as keyword arguments is deprecated.
769-
These parameters will become positional-only in Python 3.15.
768+
Passing *name*, *narg*, and *func* as keyword arguments is deprecated.
769+
These parameters will become positional-only in Python 3.15.
770770

771771

772772
.. method:: create_aggregate(name, n_arg, aggregate_class)
@@ -822,10 +822,10 @@ Connection objects
822822

823823
3
824824

825-
.. versionchanged:: 3.13
825+
.. versionchanged:: 3.13
826826

827-
Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is deprecated.
828-
These parameters will become positional-only in Python 3.15.
827+
Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is deprecated.
828+
These parameters will become positional-only in Python 3.15.
829829

830830

831831
.. method:: create_window_function(name, num_params, aggregate_class, /)
@@ -991,6 +991,11 @@ Connection objects
991991
.. versionchanged:: 3.11
992992
Added support for disabling the authorizer using ``None``.
993993

994+
.. versionchanged:: 3.13
995+
996+
Passing *authorizer_callback* as a keyword argument to is deprecated.
997+
The parameter will become positional-only in Python 3.15.
998+
994999

9951000
.. method:: set_progress_handler(progress_handler, n)
9961001

@@ -1006,6 +1011,11 @@ Connection objects
10061011
currently executing query and cause it to raise a :exc:`DatabaseError`
10071012
exception.
10081013

1014+
.. versionchanged:: 3.13
1015+
1016+
Passing *progress_handler* as a keyword argument to is deprecated.
1017+
The parameter will become positional-only in Python 3.15.
1018+
10091019

10101020
.. method:: set_trace_callback(trace_callback)
10111021

@@ -1030,6 +1040,11 @@ Connection objects
10301040

10311041
.. versionadded:: 3.3
10321042

1043+
.. versionchanged:: 3.13
1044+
1045+
Passing *trace_callback* as a keyword argument to is deprecated.
1046+
The parameter will become positional-only in Python 3.15.
1047+
10331048

10341049
.. method:: enable_load_extension(enabled, /)
10351050

Doc/library/unittest.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,7 @@ Loading and running tests
20172017

20182018
.. attribute:: collectedDurations
20192019

2020-
A list containing 2-tuples of :class:`TestCase` instances and floats
2020+
A list containing 2-tuples of test case names and floats
20212021
representing the elapsed time of each test which was run.
20222022

20232023
.. versionadded:: 3.12

Doc/tools/.nitignore

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Doc/glossary.rst
2626
Doc/howto/descriptor.rst
2727
Doc/howto/enum.rst
2828
Doc/howto/isolating-extensions.rst
29-
Doc/howto/logging-cookbook.rst
3029
Doc/howto/logging.rst
3130
Doc/howto/urllib2.rst
3231
Doc/library/__future__.rst

Doc/using/configure.rst

+22-5
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,42 @@ Configure Python
55
Build Requirements
66
==================
77

8-
Features required to build CPython:
8+
Features and minimum versions required to build CPython:
99

1010
* A `C11 <https://en.cppreference.com/w/c/11>`_ compiler. `Optional C11
1111
features
1212
<https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features>`_
1313
are not required.
1414

15+
* On Windows, Microsoft Visual Studio 2017 or later is required.
16+
1517
* Support for `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ floating
1618
point numbers and `floating point Not-a-Number (NaN)
1719
<https://en.wikipedia.org/wiki/NaN#Floating_point>`_.
1820

1921
* Support for threads.
2022

21-
* OpenSSL 1.1.1 or newer for the :mod:`ssl` and :mod:`hashlib` modules.
23+
* OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended
24+
minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules.
2225

23-
* On Windows, Microsoft Visual Studio 2017 or later is required.
26+
* SQLite 3.15.2 for the :mod:`sqlite3` extension module.
27+
28+
* Tcl/Tk 8.5.12 for the :mod:`tkinter` module.
29+
30+
* Autoconf 2.71 and aclocal 1.16.4 are required to regenerate the
31+
:file:`configure` script.
32+
33+
.. versionchanged:: 3.13:
34+
Autoconf 2.71, aclocal 1.16.4 and SQLite 3.15.2 are now required.
2435

2536
.. versionchanged:: 3.11
2637
C11 compiler, IEEE 754 and NaN support are now required.
2738
On Windows, Visual Studio 2017 or later is required.
39+
Tcl/Tk version 8.5.12 is now required for the :mod:`tkinter` module.
2840

2941
.. versionchanged:: 3.10
3042
OpenSSL 1.1.1 is now required.
43+
Require SQLite 3.7.15.
3144

3245
.. versionchanged:: 3.7
3346
Thread support and OpenSSL 1.0.2 are now required.
@@ -37,7 +50,11 @@ Features required to build CPython:
3750
inline`` functions.
3851

3952
.. versionchanged:: 3.5
40-
On Windows, Visual Studio 2015 or later is required.
53+
On Windows, Visual Studio 2015 or later is now required.
54+
Tcl/Tk version 8.4 is now required.
55+
56+
.. versionchanged:: 3.1
57+
Tcl/Tk version 8.3.1 is now required.
4158

4259
See also :pep:`7` "Style Guide for C Code" and :pep:`11` "CPython platform
4360
support".
@@ -48,7 +65,7 @@ support".
4865
Configure Options
4966
=================
5067

51-
List all ``./configure`` script options using::
68+
List all :file:`configure` script options using::
5269

5370
./configure --help
5471

Doc/whatsnew/3.13.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ Deprecated
266266
* :meth:`~sqlite3.Connection.create_function`
267267
* :meth:`~sqlite3.Connection.create_aggregate`
268268

269+
Deprecate passing the callback callable by keyword for the following
270+
:class:`sqlite3.Connection` APIs:
271+
272+
* :meth:`~sqlite3.Connection.set_authorizer`
273+
* :meth:`~sqlite3.Connection.set_progress_handler`
274+
* :meth:`~sqlite3.Connection.set_trace_callback`
275+
269276
The affected parameters will become positional-only in Python 3.15.
270277

271278
(Contributed by Erlend E. Aasland in :gh:`107948` and :gh:`108278`.)
@@ -815,7 +822,7 @@ Build Changes
815822
=============
816823

817824
* Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate
818-
:file:`!configure`.
825+
the :file:`configure` script.
819826
(Contributed by Christian Heimes in :gh:`89886`.)
820827

821828
* SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension module.

Include/cpython/object.h

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
PyAPI_FUNC(void) _Py_NewReference(PyObject *op);
66
PyAPI_FUNC(void) _Py_NewReferenceNoTotal(PyObject *op);
77

8-
#ifdef Py_TRACE_REFS
9-
/* Py_TRACE_REFS is such major surgery that we call external routines. */
10-
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
11-
#endif
12-
138
#ifdef Py_REF_DEBUG
149
/* These are useful as debugging aids when chasing down refleaks. */
1510
PyAPI_FUNC(Py_ssize_t) _Py_GetGlobalRefTotal(void);

Include/internal/pycore_object.h

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ extern void _PyDebugAllocatorStats(FILE *out, const char *block_name,
3131

3232
extern void _PyObject_DebugTypeStats(FILE *out);
3333

34+
#ifdef Py_TRACE_REFS
35+
/* Py_TRACE_REFS is such major surgery that we call external routines. */
36+
PyAPI_FUNC(void) _Py_ForgetReference(PyObject *);
37+
#endif
38+
3439
// Export for shared _testinternalcapi extension
3540
PyAPI_FUNC(int) _PyObject_IsFreed(PyObject *);
3641

0 commit comments

Comments
 (0)