summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/library/ftplib.rst8
-rw-r--r--Doc/library/http.client.rst14
-rw-r--r--Doc/library/imaplib.rst9
-rw-r--r--Doc/library/itertools.rst30
-rw-r--r--Doc/library/poplib.rst9
-rw-r--r--Doc/library/smtplib.rst18
-rw-r--r--Doc/library/socket.rst2
-rw-r--r--Doc/whatsnew/3.12.rst9
-rw-r--r--Include/object.h22
-rw-r--r--Lib/test/test_socket.py2
-rw-r--r--Lib/test/test_stable_abi_ctypes.py2
-rw-r--r--Misc/stable_abi.toml9
-rwxr-xr-xPC/python3dll.c2
13 files changed, 53 insertions, 83 deletions
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
index 4705481..e7fb5b1 100644
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -107,12 +107,6 @@ The module defines the following items:
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
:data:`ssl.HAS_SNI`).
- .. deprecated:: 3.6
- *keyfile* and *certfile* are deprecated in favor of *context*.
- Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
- :func:`ssl.create_default_context` select the system's trusted CA
- certificates for you.
-
.. versionchanged:: 3.9
If the *timeout* parameter is set to be zero, it will raise a
:class:`ValueError` to prevent the creation of a non-blocking socket.
@@ -120,7 +114,7 @@ The module defines the following items:
Latin-1 to UTF-8 to follow :rfc:`2640`.
.. versionchanged:: 3.12
- The deprecated *keyfile* and *certfile* parameters have been removed.
+ The deprecated *keyfile* and *certfile* parameters have been removed.
Here's a sample session using the :class:`FTP_TLS` class::
diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst
index 46d616a..4529193 100644
--- a/Doc/library/http.client.rst
+++ b/Doc/library/http.client.rst
@@ -95,16 +95,6 @@ The module provides the following classes:
:func:`ssl._create_unverified_context` can be passed to the *context*
parameter.
- .. deprecated:: 3.6
- *key_file* and *cert_file* are deprecated in favor of *context*.
- Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
- :func:`ssl.create_default_context` select the system's trusted CA
- certificates for you.
-
- The *check_hostname* parameter is also deprecated; the
- :attr:`ssl.SSLContext.check_hostname` attribute of *context* should
- be used instead.
-
.. versionchanged:: 3.8
This class now enables TLS 1.3
:attr:`ssl.SSLContext.post_handshake_auth` for the default *context* or
@@ -116,8 +106,8 @@ The module provides the following classes:
ALPN protocols with :meth:`~ssl.SSLContext.set_alpn_protocol`.
.. versionchanged:: 3.12
- The deprecated *key_file*, *cert_file* and *check_hostname* parameters
- have been removed.
+ The deprecated *key_file*, *cert_file* and *check_hostname* parameters
+ have been removed.
.. class:: HTTPResponse(sock, debuglevel=0, method=None, url=None)
diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst
index f1344ae..59d7711 100644
--- a/Doc/library/imaplib.rst
+++ b/Doc/library/imaplib.rst
@@ -108,18 +108,11 @@ There's also a subclass for secure connections:
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
:data:`ssl.HAS_SNI`).
- .. deprecated:: 3.6
-
- *keyfile* and *certfile* are deprecated in favor of *ssl_context*.
- Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
- :func:`ssl.create_default_context` select the system's trusted CA
- certificates for you.
-
.. versionchanged:: 3.9
The optional *timeout* parameter was added.
.. versionchanged:: 3.12
- The deprecated *keyfile* and *certfile* parameters have been removed.
+ The deprecated *keyfile* and *certfile* parameters have been removed.
The second subclass allows for connections created by a child process:
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index b3decae..56d6599 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -929,9 +929,7 @@ which incur interpreter overhead.
def sliding_window(iterable, n):
# sliding_window('ABCDEFG', 4) --> ABCD BCDE CDEF DEFG
it = iter(iterable)
- window = collections.deque(islice(it, n), maxlen=n)
- if len(window) == n:
- yield tuple(window)
+ window = collections.deque(islice(it, n-1), maxlen=n)
for x in it:
window.append(x)
yield tuple(window)
@@ -1420,8 +1418,34 @@ The following recipes have a more mathematical flavor:
>>> list(grouper('abcdefg', n=3, incomplete='ignore'))
[('a', 'b', 'c'), ('d', 'e', 'f')]
+ >>> list(sliding_window('ABCDEFG', 1))
+ [('A',), ('B',), ('C',), ('D',), ('E',), ('F',), ('G',)]
+ >>> list(sliding_window('ABCDEFG', 2))
+ [('A', 'B'), ('B', 'C'), ('C', 'D'), ('D', 'E'), ('E', 'F'), ('F', 'G')]
+ >>> list(sliding_window('ABCDEFG', 3))
+ [('A', 'B', 'C'), ('B', 'C', 'D'), ('C', 'D', 'E'), ('D', 'E', 'F'), ('E', 'F', 'G')]
>>> list(sliding_window('ABCDEFG', 4))
[('A', 'B', 'C', 'D'), ('B', 'C', 'D', 'E'), ('C', 'D', 'E', 'F'), ('D', 'E', 'F', 'G')]
+ >>> list(sliding_window('ABCDEFG', 5))
+ [('A', 'B', 'C', 'D', 'E'), ('B', 'C', 'D', 'E', 'F'), ('C', 'D', 'E', 'F', 'G')]
+ >>> list(sliding_window('ABCDEFG', 6))
+ [('A', 'B', 'C', 'D', 'E', 'F'), ('B', 'C', 'D', 'E', 'F', 'G')]
+ >>> list(sliding_window('ABCDEFG', 7))
+ [('A', 'B', 'C', 'D', 'E', 'F', 'G')]
+ >>> list(sliding_window('ABCDEFG', 8))
+ []
+ >>> try:
+ ... list(sliding_window('ABCDEFG', -1))
+ ... except ValueError:
+ ... 'zero or negative n not supported'
+ ...
+ 'zero or negative n not supported'
+ >>> try:
+ ... list(sliding_window('ABCDEFG', 0))
+ ... except ValueError:
+ ... 'zero or negative n not supported'
+ ...
+ 'zero or negative n not supported'
>>> list(roundrobin('abc', 'd', 'ef'))
['a', 'd', 'e', 'b', 'f', 'c']
diff --git a/Doc/library/poplib.rst b/Doc/library/poplib.rst
index d8618ce..260c4a6 100644
--- a/Doc/library/poplib.rst
+++ b/Doc/library/poplib.rst
@@ -79,19 +79,12 @@ The :mod:`poplib` module provides two classes:
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
:data:`ssl.HAS_SNI`).
- .. deprecated:: 3.6
-
- *keyfile* and *certfile* are deprecated in favor of *context*.
- Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
- :func:`ssl.create_default_context` select the system's trusted CA
- certificates for you.
-
.. versionchanged:: 3.9
If the *timeout* parameter is set to be zero, it will raise a
:class:`ValueError` to prevent the creation of a non-blocking socket.
.. versionchanged:: 3.12
- The deprecated *keyfile* and *certfile* parameters have been removed.
+ The deprecated *keyfile* and *certfile* parameters have been removed.
One exception is defined as an attribute of the :mod:`poplib` module:
diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst
index 4686232..f90274f 100644
--- a/Doc/library/smtplib.rst
+++ b/Doc/library/smtplib.rst
@@ -100,19 +100,12 @@ Protocol) and :rfc:`1869` (SMTP Service Extensions).
:attr:`ssl.SSLContext.check_hostname` and *Server Name Indication* (see
:data:`ssl.HAS_SNI`).
- .. deprecated:: 3.6
-
- *keyfile* and *certfile* are deprecated in favor of *context*.
- Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
- :func:`ssl.create_default_context` select the system's trusted CA
- certificates for you.
-
.. versionchanged:: 3.9
If the *timeout* parameter is set to be zero, it will raise a
:class:`ValueError` to prevent the creation of a non-blocking socket
.. versionchanged:: 3.12
- The deprecated *keyfile* and *certfile* parameters have been removed.
+ The deprecated *keyfile* and *certfile* parameters have been removed.
.. class:: LMTP(host='', port=LMTP_PORT, local_hostname=None, \
source_address=None[, timeout])
@@ -407,15 +400,8 @@ An :class:`SMTP` instance has the following methods:
If there has been no previous ``EHLO`` or ``HELO`` command this session,
this method tries ESMTP ``EHLO`` first.
- .. deprecated:: 3.6
-
- *keyfile* and *certfile* are deprecated in favor of *context*.
- Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let
- :func:`ssl.create_default_context` select the system's trusted CA
- certificates for you.
-
.. versionchanged:: 3.12
- The deprecated *keyfile* and *certfile* parameters have been removed.
+ The deprecated *keyfile* and *certfile* parameters have been removed.
:exc:`SMTPHeloError`
The server didn't reply properly to the ``HELO`` greeting.
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 5f795af..f2408cb 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -666,7 +666,7 @@ Constants
HV_GUID_BROADCAST
HV_GUID_CHILDREN
HV_GUID_LOOPBACK
- HV_GUID_LOOPBACK
+ HV_GUID_PARENT
Constants for Windows Hyper-V sockets for host/guest communications.
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst
index 287549f..4a75597 100644
--- a/Doc/whatsnew/3.12.rst
+++ b/Doc/whatsnew/3.12.rst
@@ -1535,6 +1535,15 @@ Build Changes
:file:`!configure`.
(Contributed by Christian Heimes in :gh:`89886`.)
+* C extensions built with the :ref:`limited C API <limited-c-api>`
+ on :ref:`Python build in debug mode <debug-build>` no longer support Python
+ 3.9 and older. In this configuration, :c:func:`Py_INCREF` and
+ :c:func:`Py_DECREF` are now always implemented as opaque function calls,
+ but the called functions were added to Python 3.10. Build C extensions
+ with a release build of Python or with Python 3.12 and older, to keep support
+ for Python 3.9 and older.
+ (Contributed by Victor Stinner in :gh:`102304`.)
+
C API Changes
=============
diff --git a/Include/object.h b/Include/object.h
index c2fee85..dc5b087 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -585,20 +585,14 @@ decision that's up to the implementer of each new type so if you want,
you can count such references to the type object.)
*/
-#ifdef Py_REF_DEBUG
-# if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030A0000
-extern Py_ssize_t _Py_RefTotal;
-# define _Py_INC_REFTOTAL() _Py_RefTotal++
-# define _Py_DEC_REFTOTAL() _Py_RefTotal--
-# elif !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030C0000
+#if defined(Py_REF_DEBUG) && !defined(Py_LIMITED_API)
+PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
+ PyObject *op);
PyAPI_FUNC(void) _Py_IncRefTotal_DO_NOT_USE_THIS(void);
PyAPI_FUNC(void) _Py_DecRefTotal_DO_NOT_USE_THIS(void);
# define _Py_INC_REFTOTAL() _Py_IncRefTotal_DO_NOT_USE_THIS()
# define _Py_DEC_REFTOTAL() _Py_DecRefTotal_DO_NOT_USE_THIS()
-# endif
-PyAPI_FUNC(void) _Py_NegativeRefcount(const char *filename, int lineno,
- PyObject *op);
-#endif /* Py_REF_DEBUG */
+#endif // Py_REF_DEBUG && !Py_LIMITED_API
PyAPI_FUNC(void) _Py_Dealloc(PyObject *);
@@ -616,8 +610,8 @@ PyAPI_FUNC(void) _Py_DecRef(PyObject *);
static inline Py_ALWAYS_INLINE void Py_INCREF(PyObject *op)
{
-#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
- // Stable ABI for Python 3.10 built in debug mode.
+#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API)
+ // Stable ABI for Python built in debug mode
_Py_IncRef(op);
#else
// 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)
# define Py_INCREF(op) Py_INCREF(_PyObject_CAST(op))
#endif
-#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API) && Py_LIMITED_API+0 >= 0x030A0000
-// Stable ABI for limited C API version 3.10 of Python debug build
+#if defined(Py_REF_DEBUG) && defined(Py_LIMITED_API)
+// Stable ABI for Python built in debug mode
static inline void Py_DECREF(PyObject *op) {
_Py_DecRef(op);
}
diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index 68cdc6e..0eaf642 100644
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -2566,7 +2566,7 @@ class BasicHyperVTest(unittest.TestCase):
socket.HV_GUID_BROADCAST
socket.HV_GUID_CHILDREN
socket.HV_GUID_LOOPBACK
- socket.HV_GUID_LOOPBACK
+ socket.HV_GUID_PARENT
def testCreateHyperVSocketWithUnknownProtoFailure(self):
expected = r"\[WinError 10041\]"
diff --git a/Lib/test/test_stable_abi_ctypes.py b/Lib/test/test_stable_abi_ctypes.py
index 6898367..8cad71c 100644
--- a/Lib/test/test_stable_abi_ctypes.py
+++ b/Lib/test/test_stable_abi_ctypes.py
@@ -917,8 +917,6 @@ if feature_macros['PY_HAVE_THREAD_NATIVE_ID']:
)
if feature_macros['Py_REF_DEBUG']:
SYMBOL_NAMES += (
- '_Py_DecRefTotal_DO_NOT_USE_THIS',
- '_Py_IncRefTotal_DO_NOT_USE_THIS',
'_Py_NegativeRefcount',
'_Py_RefTotal',
)
diff --git a/Misc/stable_abi.toml b/Misc/stable_abi.toml
index 1db9848..48299e9 100644
--- a/Misc/stable_abi.toml
+++ b/Misc/stable_abi.toml
@@ -2406,12 +2406,3 @@
added = '3.12'
[const.Py_TPFLAGS_ITEMS_AT_END]
added = '3.12'
-
-[function._Py_IncRefTotal_DO_NOT_USE_THIS]
- added = '3.12'
- ifdef = 'Py_REF_DEBUG'
- abi_only = true
-[function._Py_DecRefTotal_DO_NOT_USE_THIS]
- added = '3.12'
- ifdef = 'Py_REF_DEBUG'
- abi_only = true
diff --git a/PC/python3dll.c b/PC/python3dll.c
index 5665d55..505feef 100755
--- a/PC/python3dll.c
+++ b/PC/python3dll.c
@@ -17,9 +17,7 @@ EXPORT_FUNC(_Py_BuildValue_SizeT)
EXPORT_FUNC(_Py_CheckRecursiveCall)
EXPORT_FUNC(_Py_Dealloc)
EXPORT_FUNC(_Py_DecRef)
-EXPORT_FUNC(_Py_DecRefTotal_DO_NOT_USE_THIS)
EXPORT_FUNC(_Py_IncRef)
-EXPORT_FUNC(_Py_IncRefTotal_DO_NOT_USE_THIS)
EXPORT_FUNC(_Py_NegativeRefcount)
EXPORT_FUNC(_Py_VaBuildValue_SizeT)
EXPORT_FUNC(_PyArg_Parse_SizeT)