Skip to content

Commit 8b89592

Browse files
committed
Merge branch '3.12' of https://github.com/python/cpython into 3.12
2 parents 9824a28 + e33add4 commit 8b89592

File tree

13 files changed

+53
-83
lines changed

13 files changed

+53
-83
lines changed

Doc/library/ftplib.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,14 @@ The module defines the following items:
107107
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
108108
:data:`ssl.HAS_SNI`).
109109

110-
.. deprecated:: 3.6
111-
*keyfile* and *certfile* are deprecated in favor of *context*.
112-
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
113-
:func:`ssl.create_default_context` select the system's trusted CA
114-
certificates for you.
115-
116110
.. versionchanged:: 3.9
117111
If the *timeout* parameter is set to be zero, it will raise a
118112
:class:`ValueError` to prevent the creation of a non-blocking socket.
119113
The *encoding* parameter was added, and the default was changed from
120114
Latin-1 to UTF-8 to follow :rfc:`2640`.
121115

122116
.. versionchanged:: 3.12
123-
The deprecated *keyfile* and *certfile* parameters have been removed.
117+
The deprecated *keyfile* and *certfile* parameters have been removed.
124118

125119
Here's a sample session using the :class:`FTP_TLS` class::
126120

Doc/library/http.client.rst

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,6 @@ The module provides the following classes:
9595
:func:`ssl._create_unverified_context` can be passed to the *context*
9696
parameter.
9797

98-
.. deprecated:: 3.6
99-
*key_file* and *cert_file* are deprecated in favor of *context*.
100-
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
101-
:func:`ssl.create_default_context` select the system's trusted CA
102-
certificates for you.
103-
104-
The *check_hostname* parameter is also deprecated; the
105-
:attr:`ssl.SSLContext.check_hostname` attribute of *context* should
106-
be used instead.
107-
10898
.. versionchanged:: 3.8
10999
This class now enables TLS 1.3
110100
:attr:`ssl.SSLContext.post_handshake_auth` for the default *context* or
@@ -116,8 +106,8 @@ The module provides the following classes:
116106
ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`.
117107

118108
.. versionchanged:: 3.12
119-
The deprecated *key_file*, *cert_file* and *check_hostname* parameters
120-
have been removed.
109+
The deprecated *key_file*, *cert_file* and *check_hostname* parameters
110+
have been removed.
121111

122112

123113
.. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None)

Doc/library/imaplib.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,11 @@ There's also a subclass for secure connections:
108108
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
109109
:data:`ssl.HAS_SNI`).
110110

111-
.. deprecated:: 3.6
112-
113-
*keyfile* and *certfile* are deprecated in favor of *ssl_context*.
114-
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
115-
:func:`ssl.create_default_context` select the system's trusted CA
116-
certificates for you.
117-
118111
.. versionchanged:: 3.9
119112
The optional *timeout* parameter was added.
120113

121114
.. versionchanged:: 3.12
122-
The deprecated *keyfile* and *certfile* parameters have been removed.
115+
The deprecated *keyfile* and *certfile* parameters have been removed.
123116

124117
The second subclass allows for connections created by a child process:
125118

Doc/library/itertools.rst

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,7 @@ which incur interpreter overhead.
929929
def sliding_window(iterable, n):
930930
# sliding_window('ABCDEFG', 4) --> ABCD BCDE CDEF DEFG
931931
it = iter(iterable)
932-
window = collections.deque(islice(it, n), maxlen=n)
933-
if len(window) == n:
934-
yield tuple(window)
932+
window = collections.deque(islice(it, n-1), maxlen=n)
935933
for x in it:
936934
window.append(x)
937935
yield tuple(window)
@@ -1420,8 +1418,34 @@ The following recipes have a more mathematical flavor:
14201418
>>> list(grouper('abcdefg', n=3, incomplete='ignore'))
14211419
[('a', 'b', 'c'), ('d', 'e', 'f')]
14221420

1421+
>>> list(sliding_window('ABCDEFG', 1))
1422+
[('A',), ('B',), ('C',), ('D',), ('E',), ('F',), ('G',)]
1423+
>>> list(sliding_window('ABCDEFG', 2))
1424+
[('A', 'B'), ('B', 'C'), ('C', 'D'), ('D', 'E'), ('E', 'F'), ('F', 'G')]
1425+
>>> list(sliding_window('ABCDEFG', 3))
1426+
[('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E'), ('D', 'E', 'F'), ('E', 'F', 'G')]
14231427
>>> list(sliding_window('ABCDEFG', 4))
14241428
[('A', 'B', 'C', 'D'), ('B', 'C', 'D', 'E'), ('C', 'D', 'E', 'F'), ('D', 'E', 'F', 'G')]
1429+
>>> list(sliding_window('ABCDEFG', 5))
1430+
[('A', 'B', 'C', 'D', 'E'), ('B', 'C', 'D', 'E', 'F'), ('C', 'D', 'E', 'F', 'G')]
1431+
>>> list(sliding_window('ABCDEFG', 6))
1432+
[('A', 'B', 'C', 'D', 'E', 'F'), ('B', 'C', 'D', 'E', 'F', 'G')]
1433+
>>> list(sliding_window('ABCDEFG', 7))
1434+
[('A', 'B', 'C', 'D', 'E', 'F', 'G')]
1435+
>>> list(sliding_window('ABCDEFG', 8))
1436+
[]
1437+
>>> try:
1438+
... list(sliding_window('ABCDEFG', -1))
1439+
... except ValueError:
1440+
... 'zero or negative n not supported'
1441+
...
1442+
'zero or negative n not supported'
1443+
>>> try:
1444+
... list(sliding_window('ABCDEFG', 0))
1445+
... except ValueError:
1446+
... 'zero or negative n not supported'
1447+
...
1448+
'zero or negative n not supported'
14251449

14261450
>>> list(roundrobin('abc', 'd', 'ef'))
14271451
['a', 'd', 'e', 'b', 'f', 'c']

Doc/library/poplib.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,12 @@ The :mod:`poplib` module provides two classes:
7979
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
8080
:data:`ssl.HAS_SNI`).
8181

82-
.. deprecated:: 3.6
83-
84-
*keyfile* and *certfile* are deprecated in favor of *context*.
85-
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
86-
:func:`ssl.create_default_context` select the system's trusted CA
87-
certificates for you.
88-
8982
.. versionchanged:: 3.9
9083
If the *timeout* parameter is set to be zero, it will raise a
9184
:class:`ValueError` to prevent the creation of a non-blocking socket.
9285

9386
.. versionchanged:: 3.12
94-
The deprecated *keyfile* and *certfile* parameters have been removed.
87+
The deprecated *keyfile* and *certfile* parameters have been removed.
9588

9689
One exception is defined as an attribute of the :mod:`poplib` module:
9790

Doc/library/smtplib.rst

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,12 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
100100
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
101101
:data:`ssl.HAS_SNI`).
102102

103-
.. deprecated:: 3.6
104-
105-
*keyfile* and *certfile* are deprecated in favor of *context*.
106-
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
107-
:func:`ssl.create_default_context` select the system's trusted CA
108-
certificates for you.
109-
110103
.. versionchanged:: 3.9
111104
If the *timeout* parameter is set to be zero, it will raise a
112105
:class:`ValueError` to prevent the creation of a non-blocking socket
113106

114107
.. versionchanged:: 3.12
115-
The deprecated *keyfile* and *certfile* parameters have been removed.
108+
The deprecated *keyfile* and *certfile* parameters have been removed.
116109

117110
.. class:: LMTP(host='', port=LMTP_PORT, local_hostname=None, \
118111
source_address=None[, timeout])
@@ -407,15 +400,8 @@ An :class:`SMTP` instance has the following methods:
407400
If there has been no previous ``EHLO`` or ``HELO`` command this session,
408401
this method tries ESMTP ``EHLO`` first.
409402

410-
.. deprecated:: 3.6
411-
412-
*keyfile* and *certfile* are deprecated in favor of *context*.
413-
Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
414-
:func:`ssl.create_default_context` select the system's trusted CA
415-
certificates for you.
416-
417403
.. versionchanged:: 3.12
418-
The deprecated *keyfile* and *certfile* parameters have been removed.
404+
The deprecated *keyfile* and *certfile* parameters have been removed.
419405

420406
:exc:`SMTPHeloError`
421407
The server didn't reply properly to the ``HELO`` greeting.

Doc/library/socket.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ Constants
666666
HV_GUID_BROADCAST
667667
HV_GUID_CHILDREN
668668
HV_GUID_LOOPBACK
669-
HV_GUID_LOOPBACK
669+
HV_GUID_PARENT
670670

671671
Constants for Windows Hyper-V sockets for host/guest communications.
672672

Doc/whatsnew/3.12.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,15 @@ Build Changes
15351535
:file:`!configure`.
15361536
(Contributed by Christian Heimes in :gh:`89886`.)
15371537

1538+
* C extensions built with the :ref:`limited C API <limited-c-api>`
1539+
on :ref:`Python build in debug mode <debug-build>` no longer support Python
1540+
3.9 and older. In this configuration, :c:func:`Py_INCREF` and
1541+
:c:func:`Py_DECREF` are now always implemented as opaque function calls,
1542+
but the called functions were added to Python 3.10. Build C extensions
1543+
with a release build of Python or with Python 3.12 and older, to keep support
1544+
for Python 3.9 and older.
1545+
(Contributed by Victor Stinner in :gh:`102304`.)
1546+
15381547

15391548
C API Changes
15401549
=============

Include/object.h

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -585,20 +585,14 @@ decision that's up to the implementer of each new type so if you want,
585585
you can count such references to the type object.)
586586
*/
587587

588-
#ifdef Py_REF_DEBUG
589-
# if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030A0000
590-
extern Py_ssize_t _Py_RefTotal;
591-
# define _Py_INC_REFTOTAL() _Py_RefTotal++
592-
# define _Py_DEC_REFTOTAL() _Py_RefTotal--
593-
# elif !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030C0000
588+
#if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
589+
PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
590+
PyObject *op);
594591
PyAPI_FUNC(void) _Py_IncRefTotal_DO_NOT_USE_THIS(void);
595592
PyAPI_FUNC(void) _Py_DecRefTotal_DO_NOT_USE_THIS(void);
596593
# define _Py_INC_REFTOTAL() _Py_IncRefTotal_DO_NOT_USE_THIS()
597594
# define _Py_DEC_REFTOTAL() _Py_DecRefTotal_DO_NOT_USE_THIS()
598-
# endif
599-
PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
600-
PyObject *op);
601-
#endif /* Py_REF_DEBUG */
595+
#endif // Py_REF_DEBUG && !Py_LIMITED_API
602596

603597
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
604598

@@ -616,8 +610,8 @@ PyAPI_FUNC(void) _Py_DecRef(PyObject *);
616610

617611
static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
618612
{
619-
#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
620-
// Stable ABI for Python 3.10 built in debug mode.
613+
#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API)
614+
// Stable ABI for Python built in debug mode
621615
_Py_IncRef(op);
622616
#else
623617
// Non-limited C API and limited C API for Python 3.9 and older access
@@ -647,8 +641,8 @@ static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
647641
# define Py_INCREF(op) Py_INCREF(_PyObject_CAST(op))
648642
#endif
649643

650-
#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
651-
// Stable ABI for limited C API version 3.10 of Python debug build
644+
#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API)
645+
// Stable ABI for Python built in debug mode
652646
static inline void Py_DECREF(PyObject *op) {
653647
_Py_DecRef(op);
654648
}

Lib/test/test_socket.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2566,7 +2566,7 @@ def testHyperVConstants(self):
25662566
socket.HV_GUID_BROADCAST
25672567
socket.HV_GUID_CHILDREN
25682568
socket.HV_GUID_LOOPBACK
2569-
socket.HV_GUID_LOOPBACK
2569+
socket.HV_GUID_PARENT
25702570

25712571
def testCreateHyperVSocketWithUnknownProtoFailure(self):
25722572
expected = r"\[WinError 10041\]"

Lib/test/test_stable_abi_ctypes.py

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Misc/stable_abi.toml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,12 +2406,3 @@
24062406
added = '3.12'
24072407
[const.Py_TPFLAGS_ITEMS_AT_END]
24082408
added = '3.12'
2409-
2410-
[function._Py_IncRefTotal_DO_NOT_USE_THIS]
2411-
added = '3.12'
2412-
ifdef = 'Py_REF_DEBUG'
2413-
abi_only = true
2414-
[function._Py_DecRefTotal_DO_NOT_USE_THIS]
2415-
added = '3.12'
2416-
ifdef = 'Py_REF_DEBUG'
2417-
abi_only = true

PC/python3dll.c

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)