Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5f1cbb

Browse files
committed
Merge branch 'fix-issue-128843' of https://github.com/lincolnj1/cpython into fix-issue-128843
2 parents e12b696 + f73d17a commit f5f1cbb

103 files changed

Lines changed: 3052 additions & 2326 deletions

File tree

Some content is hidden

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

Doc/deprecations/c-api-pending-removal-in-3.18.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Pending removal in Python 3.18
66
* :c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`.
77
* :c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`.
88
* :c:func:`!_PyDict_Pop()`: :c:func:`PyDict_Pop`.
9+
* :c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`.
10+
* :c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`:
11+
use :c:func:`PyLongWriter_Create`.
912
* :c:func:`!_PyThreadState_UncheckedGet`: use :c:func:`PyThreadState_GetUnchecked`.
1013
* :c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`.
1114
* :c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`.

Doc/library/asyncio-graph.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ and debuggers.
5959
6060
async def main():
6161
async with asyncio.TaskGroup() as g:
62-
g.create_task(test())
62+
g.create_task(test(), name='test')
6363
6464
asyncio.run(main())
6565
6666
will print::
6767

68-
* Task(name='Task-2', id=0x1039f0fe0)
68+
* Task(name='test', id=0x1039f0fe0)
6969
+ Call stack:
7070
| File 't2.py', line 4, in async test()
7171
+ Awaited by:

Doc/library/dis.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ the following command can be used to display the disassembly of
7575
>>> dis.dis(myfunc)
7676
2 RESUME 0
7777
<BLANKLINE>
78-
3 LOAD_GLOBAL 0 (len)
79-
PUSH_NULL
78+
3 LOAD_GLOBAL 1 (len + NULL)
8079
LOAD_FAST 0 (alist)
8180
CALL 1
8281
RETURN_VALUE
@@ -208,7 +207,6 @@ Example:
208207
...
209208
RESUME
210209
LOAD_GLOBAL
211-
PUSH_NULL
212210
LOAD_FAST
213211
CALL
214212
RETURN_VALUE
@@ -1217,28 +1215,21 @@ iterations of the loop.
12171215

12181216
.. opcode:: LOAD_ATTR (namei)
12191217

1220-
Replaces ``STACK[-1]`` with ``getattr(STACK[-1], co_names[namei>>1])``.
1218+
If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with
1219+
``getattr(STACK[-1], co_names[namei>>1])``.
12211220

1222-
.. versionchanged:: 3.12
1223-
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
1224-
pushed to the stack before the attribute or unbound method respectively.
1225-
1226-
.. versionchanged:: 3.14
1227-
Reverted change from 3.12. The low bit of ``namei`` has no special meaning.
1228-
1229-
1230-
.. opcode:: LOAD_METHOD (namei)
1231-
1232-
Attempt to load a method named ``co_names[namei>>1]`` from the ``STACK[-1]`` object.
1233-
``STACK[-1]`` is popped.
1221+
If the low bit of ``namei`` is set, this will attempt to load a method named
1222+
``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is popped.
12341223
This bytecode distinguishes two cases: if ``STACK[-1]`` has a method with the
12351224
correct name, the bytecode pushes the unbound method and ``STACK[-1]``.
12361225
``STACK[-1]`` will be used as the first argument (``self``) by :opcode:`CALL`
12371226
or :opcode:`CALL_KW` when calling the unbound method.
12381227
Otherwise, ``NULL`` and the object returned by
12391228
the attribute lookup are pushed.
12401229

1241-
.. versionadded:: 3.14
1230+
.. versionchanged:: 3.12
1231+
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
1232+
pushed to the stack before the attribute or unbound method respectively.
12421233

12431234

12441235
.. opcode:: LOAD_SUPER_ATTR (namei)
@@ -1935,6 +1926,12 @@ but are replaced by real opcodes or removed before bytecode is generated.
19351926
This opcode is now a pseudo-instruction.
19361927

19371928

1929+
.. opcode:: LOAD_METHOD
1930+
1931+
Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode
1932+
with a flag set in the arg.
1933+
1934+
19381935
.. _opcode_collections:
19391936

19401937
Opcode collections

Doc/whatsnew/3.13.rst

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,8 +1499,20 @@ All of the following modules were deprecated in Python 3.11,
14991499
and are now removed:
15001500

15011501
* :mod:`!aifc`
1502+
1503+
* :pypi:`standard-aifc`:
1504+
Use the redistribution of ``aifc`` library from PyPI.
1505+
15021506
* :mod:`!audioop`
1507+
1508+
* :pypi:`audioop-lts`:
1509+
Use ``audioop-lts`` library from PyPI.
1510+
15031511
* :mod:`!chunk`
1512+
1513+
* :pypi:`standard-chunk`:
1514+
Use the redistribution of ``chunk`` library from PyPI.
1515+
15041516
* :mod:`!cgi` and :mod:`!cgitb`
15051517

15061518
* :class:`!cgi.FieldStorage` can typically be replaced with
@@ -1531,6 +1543,9 @@ and are now removed:
15311543
For example, the :class:`email.message.EmailMessage`
15321544
and :class:`email.message.Message` classes.
15331545

1546+
* :pypi:`standard-cgi`: and :pypi:`standard-cgitb`:
1547+
Use the redistribution of ``cgi`` and ``cgitb`` library from PyPI.
1548+
15341549
* :mod:`!crypt` and the private :mod:`!_crypt` extension.
15351550
The :mod:`hashlib` module may be an appropriate replacement
15361551
when simply hashing a value is required.
@@ -1549,37 +1564,74 @@ and are now removed:
15491564
Fork of the :mod:`!crypt` module,
15501565
wrapper to the :manpage:`crypt_r(3)` library call
15511566
and associated functionality.
1567+
* :pypi:`standard-crypt` and :pypi:`deprecated-crypt-alternative`:
1568+
Use the redistribution of ``crypt`` and reimplementation of ``_crypt`` libraries from PyPI.
15521569

15531570
* :mod:`!imghdr`:
15541571
The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic` libraries
15551572
should be used as replacements.
15561573
For example, the :func:`!puremagic.what` function can be used
15571574
to replace the :func:`!imghdr.what` function for all file formats
15581575
that were supported by :mod:`!imghdr`.
1576+
1577+
* :pypi:`standard-imghdr`:
1578+
Use the redistribution of ``imghdr`` library from PyPI.
1579+
15591580
* :mod:`!mailcap`:
15601581
Use the :mod:`mimetypes` module instead.
1582+
1583+
* :pypi:`standard-mailcap`:
1584+
Use the redistribution of ``mailcap`` library from PyPI.
1585+
15611586
* :mod:`!msilib`
15621587
* :mod:`!nis`
15631588
* :mod:`!nntplib`:
15641589
Use the :pypi:`pynntp` library from PyPI instead.
1590+
1591+
* :pypi:`standard-nntplib`:
1592+
Use the redistribution of ``nntplib`` library from PyPI.
1593+
15651594
* :mod:`!ossaudiodev`:
15661595
For audio playback, use the :pypi:`pygame` library from PyPI instead.
15671596
* :mod:`!pipes`:
15681597
Use the :mod:`subprocess` module instead.
15691598
Use :func:`shlex.quote` to replace the undocumented ``pipes.quote``
15701599
function.
1600+
1601+
* :pypi:`standard-pipes`:
1602+
Use the redistribution of ``pipes`` library from PyPI.
1603+
15711604
* :mod:`!sndhdr`:
15721605
The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-magic` libraries
15731606
should be used as replacements.
1607+
1608+
* :pypi:`standard-sndhdr`:
1609+
Use the redistribution of ``sndhdr`` library from PyPI.
1610+
15741611
* :mod:`!spwd`:
15751612
Use the :pypi:`python-pam` library from PyPI instead.
15761613
* :mod:`!sunau`
1614+
1615+
* :pypi:`standard-sunau`:
1616+
Use the redistribution of ``sunau`` library from PyPI.
1617+
15771618
* :mod:`!telnetlib`,
15781619
Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries from PyPI instead.
1620+
1621+
* :pypi:`standard-telnetlib`:
1622+
Use the redistribution of ``telnetlib`` library from PyPI.
1623+
15791624
* :mod:`!uu`:
15801625
Use the :mod:`base64` module instead, as a modern alternative.
1626+
1627+
* :pypi:`standard-uu`:
1628+
Use the redistribution of ``uu`` library from PyPI.
1629+
15811630
* :mod:`!xdrlib`
15821631

1632+
* :pypi:`standard-xdrlib`:
1633+
Use the redistribution of ``xdrlib`` library from PyPI.
1634+
15831635
(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:`104780`.)
15841636

15851637

Doc/whatsnew/3.14.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,9 @@ Deprecated
13951395
* :c:func:`!_PyBytes_Join`: use :c:func:`PyBytes_Join`.
13961396
* :c:func:`!_PyDict_GetItemStringWithError`: use :c:func:`PyDict_GetItemStringRef`.
13971397
* :c:func:`!_PyDict_Pop()`: use :c:func:`PyDict_Pop`.
1398+
* :c:func:`!_PyLong_Sign()`: use :c:func:`PyLong_GetSign`.
1399+
* :c:func:`!_PyLong_FromDigits` and :c:func:`!_PyLong_New`:
1400+
use :c:func:`PyLongWriter_Create`.
13981401
* :c:func:`!_PyThreadState_UncheckedGet`: use :c:func:`PyThreadState_GetUnchecked`.
13991402
* :c:func:`!_PyUnicode_AsString`: use :c:func:`PyUnicode_AsUTF8`.
14001403
* :c:func:`!_Py_HashPointer`: use :c:func:`Py_HashPointer`.

Include/cpython/longintrepr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,12 @@ struct _longobject {
100100
_PyLongValue long_value;
101101
};
102102

103-
PyAPI_FUNC(PyLongObject*) _PyLong_New(Py_ssize_t);
103+
Py_DEPRECATED(3.14) PyAPI_FUNC(PyLongObject*) _PyLong_New(Py_ssize_t);
104104

105105
// Return a copy of src.
106106
PyAPI_FUNC(PyObject*) _PyLong_Copy(PyLongObject *src);
107107

108-
PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits(
108+
Py_DEPRECATED(3.14) PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits(
109109
int negative,
110110
Py_ssize_t digit_count,
111111
digit *digits);

Include/cpython/longobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ PyAPI_FUNC(int) PyLong_IsZero(PyObject *obj);
8686
- On failure, set an exception, and return -1. */
8787
PyAPI_FUNC(int) PyLong_GetSign(PyObject *v, int *sign);
8888

89-
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
89+
Py_DEPRECATED(3.14) PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
9090

9191
/* _PyLong_NumBits. Return the number of bits needed to represent the
9292
absolute value of a long. For example, this returns 1 for 1 and -1, 2

Include/internal/pycore_code.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,6 @@ extern void _Py_Specialize_LoadSuperAttr(_PyStackRef global_super, _PyStackRef c
334334
_Py_CODEUNIT *instr, int load_method);
335335
extern void _Py_Specialize_LoadAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
336336
PyObject *name);
337-
extern void _Py_Specialize_LoadMethod(_PyStackRef owner, _Py_CODEUNIT *instr,
338-
PyObject *name);
339337
extern void _Py_Specialize_StoreAttr(_PyStackRef owner, _Py_CODEUNIT *instr,
340338
PyObject *name);
341339
extern void _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins,

Include/internal/pycore_magic_number.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,6 @@ Known values:
267267
Python 3.14a4 3612 (Add POP_ITER and INSTRUMENTED_POP_ITER)
268268
Python 3.14a4 3613 (Add LOAD_CONST_MORTAL instruction)
269269
Python 3.14a5 3614 (Add BINARY_OP_EXTEND)
270-
Python 3.14a5 3615 (Remove conditional stack effects)
271270
272271
Python 3.15 will start with 3650
273272
@@ -280,7 +279,7 @@ PC/launcher.c must also be updated.
280279
281280
*/
282281

283-
#define PYC_MAGIC_NUMBER 3615
282+
#define PYC_MAGIC_NUMBER 3614
284283
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
285284
(little-endian) and then appending b'\r\n'. */
286285
#define PYC_MAGIC_NUMBER_TOKEN \

0 commit comments

Comments
 (0)