Skip to content

Commit be2c3fb

Browse files
Merge remote-tracking branch 'upstream/main' into pr/143417
2 parents 2a96e82 + df35534 commit be2c3fb

Some content is hidden

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

42 files changed

+3344
-1753
lines changed

Doc/library/argparse.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ upper-cased name. For example::
753753

754754
>>> parser = argparse.ArgumentParser(prog='PROG')
755755
>>> parser.add_argument('--foo-bar')
756-
>>> parser.parse_args(['--foo-bar', 'FOO-BAR']
756+
>>> parser.parse_args(['--foo-bar', 'FOO-BAR'])
757757
Namespace(foo_bar='FOO-BAR')
758758
>>> parser.print_help()
759759
usage: [-h] [--foo-bar FOO-BAR]

Doc/library/email.message.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ message objects.
5757
:class:`~email.policy.default` policy, which follows the rules of the email
5858
RFCs except for line endings (instead of the RFC mandated ``\r\n``, it uses
5959
the Python standard ``\n`` line endings). For more information see the
60-
:mod:`~email.policy` documentation.
60+
:mod:`~email.policy` documentation. [2]_
6161

6262
.. method:: as_string(unixfrom=False, maxheaderlen=None, policy=None)
6363

@@ -749,3 +749,9 @@ message objects.
749749
.. [1] Originally added in 3.4 as a :term:`provisional module <provisional
750750
package>`. Docs for legacy message class moved to
751751
:ref:`compat32_message`.
752+
753+
.. [2] The :class:`EmailMessage` class requires a policy that provides a
754+
``content_manager`` attribute for content management methods like
755+
``set_content()`` and ``get_content()`` to work. The legacy
756+
:const:`~email.policy.compat32` policy does not support these methods
757+
and should not be used with :class:`EmailMessage`.

Doc/library/email.policy.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,13 @@ The header objects and their attributes are described in
662662
An instance of :class:`Compat32`, providing backward compatibility with the
663663
behavior of the email package in Python 3.2.
664664

665+
.. note::
666+
667+
The :const:`compat32` policy should not be used as a policy for
668+
:class:`~email.message.EmailMessage` objects, and should only be used
669+
to serialize messages that were created using the :const:`compat32`
670+
policy.
671+
665672

666673
.. rubric:: Footnotes
667674

Doc/library/os.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1979,7 +1979,8 @@ can be inherited by child processes. Since Python 3.4, file descriptors
19791979
created by Python are non-inheritable by default.
19801980

19811981
On UNIX, non-inheritable file descriptors are closed in child processes at the
1982-
execution of a new program, other file descriptors are inherited.
1982+
execution of a new program, other file descriptors are inherited. Note that
1983+
non-inheritable file descriptors are still *inherited* by child processes on :func:`os.fork`.
19831984

19841985
On Windows, non-inheritable handles and file descriptors are closed in child
19851986
processes, except for standard streams (file descriptors 0, 1 and 2: stdin, stdout

Doc/library/stdtypes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,6 +2190,15 @@ expression support in the :mod:`re` module).
21902190
Nonprintable characters are those in group Separator or Other (Z or C),
21912191
except the ASCII space.
21922192

2193+
For example:
2194+
2195+
.. doctest::
2196+
2197+
>>> ''.isprintable(), ' '.isprintable()
2198+
(True, True)
2199+
>>> '\t'.isprintable(), '\n'.isprintable()
2200+
(False, False)
2201+
21932202

21942203
.. method:: str.isspace()
21952204

Doc/library/tempfile.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ The module defines the following user-callable items:
225225
properly implements the :const:`os.O_EXCL` flag for :func:`os.open`. The
226226
file is readable and writable only by the creating user ID. If the
227227
platform uses permission bits to indicate whether a file is executable,
228-
the file is executable by no one. The file descriptor is not inherited
229-
by child processes.
228+
the file is executable by no one.
229+
230+
The file descriptor is :ref:`not inherited by child processes <fd_inheritance>`.
230231

231232
Unlike :func:`TemporaryFile`, the user of :func:`mkstemp` is responsible
232233
for deleting the temporary file when done with it.

Include/internal/pycore_code.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,12 @@ typedef struct {
160160

161161
#define INLINE_CACHE_ENTRIES_CONTAINS_OP CACHE_ENTRIES(_PyContainsOpCache)
162162

163+
typedef struct {
164+
_Py_BackoffCounter counter;
165+
} _PyCallFunctionExCache;
166+
167+
#define INLINE_CACHE_ENTRIES_CALL_FUNCTION_EX CACHE_ENTRIES(_PyCallFunctionExCache)
168+
163169
/* "Locals plus" for a code object is the set of locals + cell vars +
164170
* free vars. This relates to variable names as well as offsets into
165171
* the "fast locals" storage array of execution frames. The compiler
@@ -326,6 +332,7 @@ PyAPI_FUNC(void) _Py_Specialize_Send(_PyStackRef receiver, _Py_CODEUNIT *instr);
326332
PyAPI_FUNC(void) _Py_Specialize_ToBool(_PyStackRef value, _Py_CODEUNIT *instr);
327333
PyAPI_FUNC(void) _Py_Specialize_ContainsOp(_PyStackRef value, _Py_CODEUNIT *instr);
328334
PyAPI_FUNC(void) _Py_GatherStats_GetIter(_PyStackRef iterable);
335+
PyAPI_FUNC(void) _Py_Specialize_CallFunctionEx(_PyStackRef func_st, _Py_CODEUNIT *instr);
329336

330337
// Utility functions for reading/writing 32/64-bit values in the inline caches.
331338
// Great care should be taken to ensure that these functions remain correct and

Include/internal/pycore_interpframe.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ _PyEvalFramePushAndInit(PyThreadState *tstate, _PyStackRef func,
395395
size_t argcount, PyObject *kwnames,
396396
_PyInterpreterFrame *previous);
397397

398+
PyAPI_FUNC(_PyInterpreterFrame *)
399+
_PyEvalFramePushAndInit_Ex(PyThreadState *tstate, _PyStackRef func,
400+
PyObject *locals, Py_ssize_t nargs, PyObject *callargs, PyObject *kwargs, _PyInterpreterFrame *previous);
401+
398402
#ifdef __cplusplus
399403
}
400404
#endif

Include/internal/pycore_magic_number.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,8 @@ Known values:
288288
Python 3.15a1 3655 (Fix miscompilation of some module-level annotations)
289289
Python 3.15a2 3656 (Add TRACE_RECORD instruction, for platforms with switch based interpreter)
290290
Python 3.15a4 3657 (Add BINARY_OP_SUBSCR_USTR_INT)
291+
Python 3.15a4 3658 (Optimize bytecode for list/set called on genexp)
292+
Python 3.15a4 3659 (Add CALL_FUNCTION_EX specialization)
291293
292294
293295
Python 3.16 will start with 3700
@@ -301,7 +303,7 @@ PC/launcher.c must also be updated.
301303
302304
*/
303305

304-
#define PYC_MAGIC_NUMBER 3657
306+
#define PYC_MAGIC_NUMBER 3659
305307
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
306308
(little-endian) and then appending b'\r\n'. */
307309
#define PYC_MAGIC_NUMBER_TOKEN \

Include/internal/pycore_opcode_metadata.h

Lines changed: 19 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)