Skip to content

Commit 166aca9

Browse files
committed
Merge branch 'main' into modulelocals
* main: (57 commits) pythongh-105831: Fix NEWS blurb from pythongh-105828 (python#105833) pythongh-105820: Fix tok_mode expression buffer in file & readline tokenizer (python#105828) pythongh-105751, test_ctypes: Remove disabled tests (python#105826) pythongh-105821: Use a raw f-string in test_httpservers.py (python#105822) pythongh-105751: Remove platform usage in test_ctypes (python#105819) pythongh-105751: Reenable disable test_ctypes tests (python#105818) pythongh-105751: Remove dead code in test_ctypes (python#105817) More reorganisation of the typing docs (python#105787) Improve docs for `typing.dataclass_transform` (python#105792) pythonGH-89812: Churn `pathlib.Path` test methods (python#105807) pythongh-105800: Issue SyntaxWarning in f-strings for invalid escape sequences (python#105801) pythongh-105751: Cleanup test_ctypes imports (python#105803) pythongh-105481: add HAS_JUMP flag to opcode metadata (python#105791) pythongh-105751: test_ctypes avoids the operator module (pythonGH-105797) pythongh-105751: test_ctypes: Remove @need_symbol decorator (pythonGH-105798) pythongh-104909: Implement conditional stack effects for macros (python#105748) pythongh-75905: Remove test_xmlrpc_net: skipped since 2017 (python#105796) pythongh-105481: Fix types and a bug for pseudos (python#105788) Update DSL docs for cases generator (python#105753) pythonGH-77273: Better bytecodes for f-strings (pythonGH-6132) ...
2 parents bd0c357 + 3af2dc7 commit 166aca9

File tree

175 files changed

+4727
-3629
lines changed

Some content is hidden

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

175 files changed

+4727
-3629
lines changed

Doc/c-api/arg.rst

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -439,16 +439,24 @@ API Functions
439439
.. versionadded:: 3.2
440440
441441
442-
.. XXX deprecated, will be removed
443442
.. c:function:: int PyArg_Parse(PyObject *args, const char *format, ...)
444443
445-
Function used to deconstruct the argument lists of "old-style" functions ---
446-
these are functions which use the :const:`METH_OLDARGS` parameter parsing
447-
method, which has been removed in Python 3. This is not recommended for use
448-
in parameter parsing in new code, and most code in the standard interpreter
449-
has been modified to no longer use this for that purpose. It does remain a
450-
convenient way to decompose other tuples, however, and may continue to be
451-
used for that purpose.
444+
Parse the parameter of a function that takes a single positional parameter
445+
into a local variable. Returns true on success; on failure, it returns
446+
false and raises the appropriate exception.
447+
448+
Example::
449+
450+
// Function using METH_O calling convention
451+
static PyObject*
452+
my_function(PyObject *module, PyObject *arg)
453+
{
454+
int value;
455+
if (!PyArg_Parse(arg, "i:my_function", &value)) {
456+
return NULL;
457+
}
458+
// ... use value ...
459+
}
452460
453461
454462
.. c:function:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...)

Doc/c-api/float.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.. _floatobjects:
44

55
Floating Point Objects
6-
----------------------
6+
======================
77

88
.. index:: pair: object; floating point
99

@@ -79,7 +79,7 @@ Floating Point Objects
7979
8080
8181
Pack and Unpack functions
82-
=========================
82+
-------------------------
8383
8484
The pack and unpack functions provide an efficient platform-independent way to
8585
store floating-point values as byte strings. The Pack routines produce a bytes
@@ -104,7 +104,7 @@ happens in such cases is partly accidental (alas).
104104
.. versionadded:: 3.11
105105
106106
Pack functions
107-
--------------
107+
^^^^^^^^^^^^^^
108108
109109
The pack routines write 2, 4 or 8 bytes, starting at *p*. *le* is an
110110
:c:expr:`int` argument, non-zero if you want the bytes string in little-endian
@@ -135,7 +135,7 @@ There are two problems on non-IEEE platforms:
135135
136136
137137
Unpack functions
138-
----------------
138+
^^^^^^^^^^^^^^^^
139139
140140
The unpack routines read 2, 4 or 8 bytes, starting at *p*. *le* is an
141141
:c:expr:`int` argument, non-zero if the bytes string is in little-endian format

Doc/c-api/frame.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ See also :ref:`Reflection <reflection>`.
134134
135135
136136
Internal Frames
137-
---------------
137+
^^^^^^^^^^^^^^^
138138
139139
Unless using :pep:`523`, you will not need this.
140140

Doc/c-api/slice.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Slice Objects
113113
114114
115115
Ellipsis Object
116-
---------------
116+
^^^^^^^^^^^^^^^
117117
118118
119119
.. c:var:: PyObject *Py_Ellipsis

Doc/library/dis.rst

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,26 +1465,47 @@ iterations of the loop.
14651465
an argument from two-byte to four-byte.
14661466

14671467

1468-
.. opcode:: FORMAT_VALUE (flags)
1468+
.. opcode:: CONVERT_VALUE (oparg)
14691469

1470-
Used for implementing formatted literal strings (f-strings). Pops
1471-
an optional *fmt_spec* from the stack, then a required *value*.
1472-
*flags* is interpreted as follows:
1470+
Convert value to a string, depending on ``oparg``::
14731471

1474-
* ``(flags & 0x03) == 0x00``: *value* is formatted as-is.
1475-
* ``(flags & 0x03) == 0x01``: call :func:`str` on *value* before
1476-
formatting it.
1477-
* ``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before
1478-
formatting it.
1479-
* ``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before
1480-
formatting it.
1481-
* ``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use
1482-
it, else use an empty *fmt_spec*.
1472+
value = STACK.pop()
1473+
result = func(value)
1474+
STACK.push(result)
14831475

1484-
Formatting is performed using :c:func:`PyObject_Format`. The
1485-
result is pushed on the stack.
1476+
* ``oparg == 1``: call :func:`str` on *value*
1477+
* ``oparg == 2``: call :func:`repr` on *value*
1478+
* ``oparg == 3``: call :func:`ascii` on *value*
14861479

1487-
.. versionadded:: 3.6
1480+
Used for implementing formatted literal strings (f-strings).
1481+
1482+
.. versionadded:: 3.13
1483+
1484+
1485+
.. opcode:: FORMAT_SIMPLE
1486+
1487+
Formats the value on top of stack::
1488+
1489+
value = STACK.pop()
1490+
result = value.__format__("")
1491+
STACK.push(result)
1492+
1493+
Used for implementing formatted literal strings (f-strings).
1494+
1495+
.. versionadded:: 3.13
1496+
1497+
.. opcode:: FORMAT_SPEC
1498+
1499+
Formats the given value with the given format spec::
1500+
1501+
spec = STACK.pop()
1502+
value = STACK.pop()
1503+
result = value.__format__(spec)
1504+
STACK.push(result)
1505+
1506+
Used for implementing formatted literal strings (f-strings).
1507+
1508+
.. versionadded:: 3.13
14881509

14891510

14901511
.. opcode:: MATCH_CLASS (count)

Doc/library/tarfile.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ can be:
908908
path to where the archive is extracted (i.e. the same path is used for all
909909
members)::
910910

911-
filter(/, member: TarInfo, path: str) -> TarInfo | None
911+
filter(member: TarInfo, path: str, /) -> TarInfo | None
912912

913913
The callable is called just before each member is extracted, so it can
914914
take the current state of the disk into account.
@@ -928,13 +928,13 @@ Default named filters
928928
The pre-defined, named filters are available as functions, so they can be
929929
reused in custom filters:
930930

931-
.. function:: fully_trusted_filter(/, member, path)
931+
.. function:: fully_trusted_filter(member, path)
932932

933933
Return *member* unchanged.
934934

935935
This implements the ``'fully_trusted'`` filter.
936936

937-
.. function:: tar_filter(/, member, path)
937+
.. function:: tar_filter(member, path)
938938

939939
Implements the ``'tar'`` filter.
940940

@@ -951,7 +951,7 @@ reused in custom filters:
951951

952952
Return the modified ``TarInfo`` member.
953953

954-
.. function:: data_filter(/, member, path)
954+
.. function:: data_filter(member, path)
955955

956956
Implements the ``'data'`` filter.
957957
In addition to what ``tar_filter`` does:

0 commit comments

Comments
 (0)