mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
Merge branch '3.12' of https://github.com/python/cpython into 3.12
This commit is contained in:
commit
8b895929dd
13 changed files with 53 additions and 83 deletions
|
|
@ -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::
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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']
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
=============
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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\]"
|
||||
|
|
|
|||
2
Lib/test/test_stable_abi_ctypes.py
generated
2
Lib/test/test_stable_abi_ctypes.py
generated
|
|
@ -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',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
2
PC/python3dll.c
generated
2
PC/python3dll.c
generated
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue