8000 Merge remote-tracking branch 'origin/master' into optimize-pymalloc · python/cpython@a690ddb · GitHub
[go: up one dir, main page]

Skip to content

Commit a690ddb

Browse files
committed
Merge remote-tracking branch 'origin/master' into optimize-pymalloc
2 parents b783e25 + c8e7146 commit a690ddb

File tree

157 files changed

+1460
-1284
lines changed

Some content is hidden

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

157 files changed

+1460
-1284
lines changed

Doc/c-api/list.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ List Objects
5959
.. c:function:: PyObject* PyList_GetItem(PyObject *list, Py_ssize_t index)
6060
6161
Return the object at position *index* in the list pointed to by *list*. The
62-
position must be positive, indexing from the end of the list is not
63-
supported. If *index* is out of bounds, return *NULL* and set an
64-
:exc:`IndexError` exception.
62+
position must be non-negative; indexing from the end of the list is not
63+
supported. If *index* is out of bounds (<0 or >=len(list)),
64+
return *NULL* and set an :exc:`IndexError` exception.
6565
6666
6767
.. c:function:: PyObject* PyList_GET_ITEM(PyObject *list, Py_ssize_t i)

Doc/c-api/memory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ example::
6767

6868
In this example, the memory request for the I/O buffer is handled by the C
6969
library allocator. The Python memory manager is involved only in the allocation
70-
of the string object returned as a result.
70+
of the bytes object returned as a result.
7171

7272
In most situations, however, it is recommended to allocate memory from the
7373
Python heap specifically because the latter is under control of the Python

Doc/c-api/object.rst

Lines changed: 34 additions & 0 deletions
Origin 10000 al file line numberDiff line numberDiff line change
@@ -264,6 +264,17 @@ Object Protocol
264264
.. versionadded:: 3.9
265265
266266
267+
.. c:function:: PyObject* _PyObject_CallOneArg(PyObject *callable, PyObject *arg)
268+
269+
Call a callable Python object *callable* with exactly 1 positional argument
270+
*arg* and no keyword arguments.
271+
272+
Return the result of the call on success, or raise an exception and return
273+
*NULL* on failure.
274+
275+
.. versionadded:: 3.9
276+
277+
267278
.. c:function:: PyObject* PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
268279
269280
Call a callable Python object *callable*, with arguments given by the
@@ -353,6 +364,29 @@ Object Protocol
353364
*NULL* on failure.
354365
355366
367+
.. c:function:: PyObject* _PyObject_CallMethodNoArgs(PyObject *obj, PyObject *name)
368+
369+
Call a method of the Python object *obj* without arguments,
370+
where the name of the method is given as a Python string object in *name*.
371+
372+
Return the result of the call on success, or raise an exception and return
373+
*NULL* on failure.
374+
375+
.. versionadded:: 3.9
376+
377+
378+
.. c:function:: PyObject* _PyObject_CallMethodOneArg(PyObject *obj, PyObject *name, PyObject *arg)
379+
380+
Call a method of the Python object *obj* with a single positional argument
381+
*arg*, where the name of the method is given as a Python string object in
382+
*name*.
383+
384+
Return the result of the call on success, or raise an exception and return
385+
*NULL* on failure.
386+
387+
.. versionadded:: 3.9
388+
389+
356390
.. c:function:: PyObject* _PyObject_Vectorcall(PyObject *callable, PyObject *const *args, size_t nargsf, PyObject *kwnames)
357391
358392
Call a callable Python object *callable*, using

Doc/distutils/apiref.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,9 @@ Subclasses of :class:`Command` must define the following methods.
18631863
.. module:: distutils.command.bdist_wininst
18641864
:synopsis: Build a Windows installer
18651865

1866+
.. deprecated:: 3.8
1867+
Use bdist_wheel (wheel packages) instead.
1868+
18661869

18671870
.. % todo
18681871

Doc/distutils/builtdist.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ generated by each, are:
146146
| :command:`bdist_msi` | msi |
147147
+--------------------------+-------------------------------------+
148148

149+
.. note::
150+
bdist_wininst is deprecated since Python 3.8.
151+
149152
The following sections give details on the individual :command:`bdist_\*`
150153
commands.
151154

@@ -298,6 +301,9 @@ file winds up deep in the "build tree," in a temporary directory created by
298301
Creating Windows Installers
299302
===========================
300303

304+
.. warning::
305+
bdist_wininst is deprecated since Python 3.8.
306+
301307
Executable installers are the natural format for binary distributions on
302308
Windows. They display a nice graphical user interface, display some information
303309
about the module distribution to be installed taken from the metadata in the
@@ -459,3 +465,6 @@ Starting with Python 2.6, bdist_wininst supports a :option:`!--user-access-contr
459465
option. The default is 'none' (meaning no UAC handling is done), and other
460466
valid values are 'auto' (meaning prompt for UAC elevation if Python was
461467
installed for all users) and 'force' (meaning always prompt for elevation).
468+
469+
.. note::
470+
bdist_wininst is deprecated since Python 3.8.

Doc/extending/newtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ done. This can be done using the :c:func:`PyErr_Fetch` and
104104
/* This saves the current exception state */
105105
PyErr_Fetch(&err_type, &err_value, &err_traceback);
106106

107-
cbresult = PyObject_CallObject(self->my_callback, NULL);
107+
cbresult = PyObject_CallNoArgs(self->my_callback);
108108
if (cbresult == NULL)
109109
PyErr_WriteUnraisable(self->my_callback);
110110
else

Doc/faq/programming.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,6 @@ an error::
800800
File "<stdin>", line 1, in <module>
801801
TypeError: pow() takes no keyword arguments
802802

803-
Note that as of this writing this is only documentational and no valid syntax
804-
in Python, although there is :pep:`570`, which proposes a syntax for
805-
position-only parameters in Python.
806-
807803

808804
Numbers and strings
809805
===================

Doc/library/ctypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ Here is a simple example of a POINT structure, which contains two integers named
576576
>>> POINT(1, 2, 3)
577577
Traceback (most recent call last):
578578
File "<stdin>", line 1, in <module>
579-
ValueError: too many initializers
579+
TypeError: too many initializers
580580
>>>
581581

582582
You can, however, build much more complicated structures. A structure can

Doc/library/enum.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -739,9 +739,11 @@ Some rules:
739739
:meth:`__str__` and :meth:`__repr__` respectively; other codes (such as
740740
`%i` or `%h` for IntEnum) treat the enum member as its mixed-in type.
741741
5. :ref:`Formatted string literals <f-strings>`, :meth:`str.format`,
742-
and :func:`format` will use the mixed-in
743-
type's :meth:`__format__`. If the :class:`Enum` class's :func:`str` or
744-
:func:`repr` is desired, use the `!s` or `!r` format codes.
742+
and :func:`format` will use the mixed-in type's :meth:`__format__`
743+
unless :meth:`__str__` or :meth:`__format__` is overridden in the subclass,
744+
in which case the overridden methods or :class:`Enum` methods will be used.
745+
Use the !s and !r format codes to force usage of the :class:`Enum` class's
746+
:meth:`__str__` and :meth:`__repr__` methods.
745747

746748
When to use :meth:`__new__` vs. :meth:`__init__`
747749
------------------------------------------------

Doc/library/idle.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,10 @@ or ``print`` or ``write`` to sys.stdout or sys.stderr,
713713
IDLE should be started in a command line window. The secondary subprocess
714714
will then be attached to that window for input and output.
715715

716+
The IDLE code running in the execution process adds frames to the call stack
717+
that would not be there otherwise. IDLE wraps ``sys.getrecursionlimit`` and
718+
``sys.setrecursionlimit`` to reduce the effect of the additional stack frames.
719+
716720
If ``sys`` is reset by user code, such as with ``importlib.reload(sys)``,
717721
IDLE's changes are lost and input from the keyboard and output to the screen
718722
will not work correctly.

0 commit comments

Comments
 (0)
0