Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7a858d6

Browse files
Merge remote-tracking branch 'upstream/main' into dict
2 parents6468c7c +49365bd commit7a858d6

File tree

115 files changed

+5305
-1356
lines changed

Some content is hidden

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

115 files changed

+5305
-1356
lines changed

‎.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ Modules/Setup* @erlend-aasland
2626
**/*context*@1st1
2727
**/*genobject*@markshannon
2828
**/*hamt*@1st1
29-
**/*jit*@brandtbucher@savannahostrowski
29+
**/*jit*@brandtbucher@savannahostrowski@diegorusso
30+
Python/perf_jit_trampoline.c# Exclude the owners of "**/*jit*", above.
3031
Objects/set*@rhettinger
3132
Objects/dict*@methane@markshannon
3233
Objects/typevarobject.c@JelleZijlstra

‎Android/android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def unpack_deps(host, prefix_dir):
175175
os.chdir(prefix_dir)
176176
deps_url="https://github.com/beeware/cpython-android-source-deps/releases/download"
177177
forname_verin ["bzip2-1.0.8-3","libffi-3.4.4-3","openssl-3.0.15-4",
178-
"sqlite-3.49.1-0","xz-5.4.6-1"]:
178+
"sqlite-3.49.1-0","xz-5.4.6-1","zstd-1.5.7-1"]:
179179
filename=f"{name_ver}-{host}.tar.gz"
180180
download(f"{deps_url}/{name_ver}/{filename}")
181181
shutil.unpack_archive(filename)

‎Doc/c-api/exceptions.rst

Lines changed: 187 additions & 251 deletions
Large diffs are not rendered by default.

‎Doc/conf.py

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -233,75 +233,6 @@
233233
# Temporary undocumented names.
234234
# In future this list must be empty.
235235
nitpick_ignore+= [
236-
# C API: Standard Python exception classes
237-
('c:data','PyExc_ArithmeticError'),
238-
('c:data','PyExc_AssertionError'),
239-
('c:data','PyExc_AttributeError'),
240-
('c:data','PyExc_BaseException'),
241-
('c:data','PyExc_BaseExceptionGroup'),
242-
('c:data','PyExc_BlockingIOError'),
243-
('c:data','PyExc_BrokenPipeError'),
244-
('c:data','PyExc_BufferError'),
245-
('c:data','PyExc_ChildProcessError'),
246-
('c:data','PyExc_ConnectionAbortedError'),
247-
('c:data','PyExc_ConnectionError'),
248-
('c:data','PyExc_ConnectionRefusedError'),
249-
('c:data','PyExc_ConnectionResetError'),
250-
('c:data','PyExc_EOFError'),
251-
('c:data','PyExc_Exception'),
252-
('c:data','PyExc_FileExistsError'),
253-
('c:data','PyExc_FileNotFoundError'),
254-
('c:data','PyExc_FloatingPointError'),
255-
('c:data','PyExc_GeneratorExit'),
256-
('c:data','PyExc_ImportError'),
257-
('c:data','PyExc_IndentationError'),
258-
('c:data','PyExc_IndexError'),
259-
('c:data','PyExc_InterruptedError'),
260-
('c:data','PyExc_IsADirectoryError'),
261-
('c:data','PyExc_KeyboardInterrupt'),
262-
('c:data','PyExc_KeyError'),
263-
('c:data','PyExc_LookupError'),
264-
('c:data','PyExc_MemoryError'),
265-
('c:data','PyExc_ModuleNotFoundError'),
266-
('c:data','PyExc_NameError'),
267-
('c:data','PyExc_NotADirectoryError'),
268-
('c:data','PyExc_NotImplementedError'),
269-
('c:data','PyExc_OSError'),
270-
('c:data','PyExc_OverflowError'),
271-
('c:data','PyExc_PermissionError'),
272-
('c:data','PyExc_ProcessLookupError'),
273-
('c:data','PyExc_PythonFinalizationError'),
274-
('c:data','PyExc_RecursionError'),
275-
('c:data','PyExc_ReferenceError'),
276-
('c:data','PyExc_RuntimeError'),
277-
('c:data','PyExc_StopAsyncIteration'),
278-
('c:data','PyExc_StopIteration'),
279-
('c:data','PyExc_SyntaxError'),
280-
('c:data','PyExc_SystemError'),
281-
('c:data','PyExc_SystemExit'),
282-
('c:data','PyExc_TabError'),
283-
('c:data','PyExc_TimeoutError'),
284-
('c:data','PyExc_TypeError'),
285-
('c:data','PyExc_UnboundLocalError'),
286-
('c:data','PyExc_UnicodeDecodeError'),
287-
('c:data','PyExc_UnicodeEncodeError'),
288-
('c:data','PyExc_UnicodeError'),
289-
('c:data','PyExc_UnicodeTranslateError'),
290-
('c:data','PyExc_ValueError'),
291-
('c:data','PyExc_ZeroDivisionError'),
292-
# C API: Standard Python warning classes
293-
('c:data','PyExc_BytesWarning'),
294-
('c:data','PyExc_DeprecationWarning'),
295-
('c:data','PyExc_EncodingWarning'),
296-
('c:data','PyExc_FutureWarning'),
297-
('c:data','PyExc_ImportWarning'),
298-
('c:data','PyExc_PendingDeprecationWarning'),
299-
('c:data','PyExc_ResourceWarning'),
300-
('c:data','PyExc_RuntimeWarning'),
301-
('c:data','PyExc_SyntaxWarning'),
302-
('c:data','PyExc_UnicodeWarning'),
303-
('c:data','PyExc_UserWarning'),
304-
('c:data','PyExc_Warning'),
305236
# Undocumented public C macros
306237
('c:macro','Py_BUILD_ASSERT'),
307238
('c:macro','Py_BUILD_ASSERT_EXPR'),

‎Doc/glossary.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,16 @@ Glossary
12801280
and ending with double underscores. Special methods are documented in
12811281
:ref:`specialnames`.
12821282

1283+
standard library
1284+
The collection of:term:`packages <package>`,:term:`modules <module>`
1285+
and:term:`extension modules <extension module>` distributed as a part
1286+
of the official Python interpreter package. The exact membership of the
1287+
collection may vary based on platform, available system libraries, or
1288+
other criteria. Documentation can be found at:ref:`library-index`.
1289+
1290+
See also:data:`sys.stdlib_module_names` for a list of all possible
1291+
standard library module names.
1292+
12831293
statement
12841294
A statement is part of a suite (a "block" of code). A statement is either
12851295
an:term:`expression` or one of several constructs with a keyword, such
@@ -1290,6 +1300,9 @@ Glossary
12901300
issues such as incorrect types. See also:term:`type hints <type hint>`
12911301
and the:mod:`typing` module.
12921302

1303+
stdlib
1304+
An abbreviation of:term:`standard library`.
1305+
12931306
strong reference
12941307
In Python's C API, a strong reference is a reference to an object
12951308
which is owned by the code holding the reference. The strong

‎Doc/howto/logging-cookbook.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4140,6 +4140,42 @@ The script, when run, prints something like:
41404140
2025-07-02 13:54:47,234 DEBUG fool me ...
41414141
2025-07-02 13:54:47,234 DEBUG can't get fooled again
41424142
4143+
If, on the other hand, you are concerned about `log injection
4144+
<https://owasp.org/www-community/attacks/Log_Injection>`_, you can use a
4145+
formatter which escapes newlines, as per the following example:
4146+
4147+
..code-block::python
4148+
4149+
import logging
4150+
4151+
logger= logging.getLogger(__name__)
4152+
4153+
classEscapingFormatter(logging.Formatter):
4154+
defformat(self,record):
4155+
s=super().format(record)
4156+
return s.replace('\n',r'\n')
4157+
4158+
if__name__=='__main__':
4159+
h= logging.StreamHandler()
4160+
h.setFormatter(EscapingFormatter('%(asctime)s%(levelname)-9s%(message)s'))
4161+
logging.basicConfig(level=logging.DEBUG,handlers= [h])
4162+
logger.debug('Single line')
4163+
logger.debug('Multiple lines:\nfool me once ...')
4164+
logger.debug('Another single line')
4165+
logger.debug('Multiple lines:\n%s','fool me ...\ncan\'t get fooled again')
4166+
4167+
You can, of course, use whatever escaping scheme makes the most sense for you.
4168+
The script, when run, should produce output like this:
4169+
4170+
..code-block::text
4171+
4172+
2025-07-09 06:47:33,783 DEBUG Single line
4173+
2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me once ...
4174+
2025-07-09 06:47:33,783 DEBUG Another single line
4175+
2025-07-09 06:47:33,783 DEBUG Multiple lines:\nfool me ...\ncan't get fooled again
4176+
4177+
Escaping behaviour can't be the stdlib default , as it would break backwards
4178+
compatibility.
41434179

41444180
.. patterns-to-avoid:
41454181

‎Doc/library/codecs.rst

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ wider range of codecs when working with binary files:
243243
..function::iterencode(iterator, encoding, errors='strict', **kwargs)
244244

245245
Uses an incremental encoder to iteratively encode the input provided by
246-
*iterator*.This function is a:term:`generator`.
247-
The *errors* argument (as well as any
246+
*iterator*.*iterator* must yield:class:`str` objects.
247+
This function is a:term:`generator`.The *errors* argument (as well as any
248248
other keyword argument) is passed through to the incremental encoder.
249249

250250
This function requires that the codec accept text:class:`str` objects
@@ -255,8 +255,8 @@ wider range of codecs when working with binary files:
255255
..function::iterdecode(iterator, encoding, errors='strict', **kwargs)
256256

257257
Uses an incremental decoder to iteratively decode the input provided by
258-
*iterator*.This function is a:term:`generator`.
259-
The *errors* argument (as well as any
258+
*iterator*.*iterator* must yield:class:`bytes` objects.
259+
This function is a:term:`generator`.The *errors* argument (as well as any
260260
other keyword argument) is passed through to the incremental decoder.
261261

262262
This function requires that the codec accept:class:`bytes` objects
@@ -265,6 +265,20 @@ wider range of codecs when working with binary files:
265265
:func:`iterencode`.
266266

267267

268+
..function::readbuffer_encode(buffer, errors=None, /)
269+
270+
Return a:class:`tuple` containing the raw bytes of *buffer*, a
271+
:ref:`buffer-compatible object<bufferobjects>` or:class:`str`
272+
(encoded to UTF-8 before processing), and their length in bytes.
273+
274+
The *errors* argument is ignored.
275+
276+
..code-block::pycon
277+
278+
>>> codecs.readbuffer_encode(b"Zito")
279+
(b'Zito', 4)
280+
281+
268282
The module also provides the following constants which are useful for reading
269283
and writing to platform dependent files:
270284

@@ -1484,6 +1498,66 @@ mapping. It is not supported by :meth:`str.encode` (which only produces
14841498
Restoration of the ``rot13`` alias.
14851499

14861500

1501+
:mod:`encodings` --- Encodings package
1502+
--------------------------------------
1503+
1504+
..module::encodings
1505+
:synopsis: Encodings package
1506+
1507+
This module implements the following functions:
1508+
1509+
..function::normalize_encoding(encoding)
1510+
1511+
Normalize encoding name *encoding*.
1512+
1513+
Normalization works as follows: all non-alphanumeric characters except the
1514+
dot used for Python package names are collapsed and replaced with a single
1515+
underscore, leading and trailing underscores are removed.
1516+
For example, ``' -;#'`` becomes ``'_'``.
1517+
1518+
Note that *encoding* should be ASCII only.
1519+
1520+
1521+
..note::
1522+
The following functions should not be used directly, except for testing
1523+
purposes;:func:`codecs.lookup` should be used instead.
1524+
1525+
1526+
..function::search_function(encoding)
1527+
1528+
Search for the codec module corresponding to the given encoding name
1529+
*encoding*.
1530+
1531+
This function first normalizes the *encoding* using
1532+
:func:`normalize_encoding`, then looks for a corresponding alias.
1533+
It attempts to import a codec module from the encodings package using either
1534+
the alias or the normalized name. If the module is found and defines a valid
1535+
``getregentry()`` function that returns a:class:`codecs.CodecInfo` object,
1536+
the codec is cached and returned.
1537+
1538+
If the codec module defines a ``getaliases()`` function any returned aliases
1539+
are registered for future use.
1540+
1541+
1542+
..function::win32_code_page_search_function(encoding)
1543+
1544+
Search for a Windows code page encoding *encoding* of the form ``cpXXXX``.
1545+
1546+
If the code page is valid and supported, return a:class:`codecs.CodecInfo`
1547+
object for it.
1548+
1549+
..availability::Windows.
1550+
1551+
..versionadded::3.14
1552+
1553+
1554+
This module implements the following exception:
1555+
1556+
..exception::CodecRegistryError
1557+
1558+
Raised when a codec is invalid or incompatible.
1559+
1560+
14871561
:mod:`encodings.idna` --- Internationalized Domain Names in Applications
14881562
------------------------------------------------------------------------
14891563

‎Doc/library/exceptions.rst

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,24 @@ The following exceptions are the exceptions that are usually raised.
204204
assignment fails. (When an object does not support attribute references or
205205
attribute assignments at all,:exc:`TypeError` is raised.)
206206

207-
The:attr:`name` and:attr:`obj` attributes can be set using keyword-only
208-
arguments to the constructor. When set they represent the name of the attribute
209-
that was attempted to be accessed and the object that was accessed for said
210-
attribute, respectively.
207+
The optional *name* and *obj* keyword-only arguments
208+
set the corresponding attributes:
209+
210+
..attribute::name
211+
212+
The name of the attribute that was attempted to be accessed.
213+
214+
..attribute::obj
215+
216+
The object that was accessed for the named attribute.
211217

212218
..versionchanged::3.10
213219
Added the:attr:`name` and:attr:`obj` attributes.
214220

215221
..exception::EOFError
216222

217223
Raised when the:func:`input` function hits an end-of-file condition (EOF)
218-
without reading any data. (N.B.: the:meth:`io.IOBase.read` and
224+
without reading any data. (Note: the:meth:`!io.IOBase.read` and
219225
:meth:`io.IOBase.readline` methods return an empty string when they hit EOF.)
220226

221227

@@ -312,9 +318,11 @@ The following exceptions are the exceptions that are usually raised.
312318
unqualified names. The associated value is an error message that includes the
313319
name that could not be found.
314320

315-
The:attr:`name` attribute can be set using a keyword-only argument to the
316-
constructor. When set it represent the name of the variable that was attempted
317-
to be accessed.
321+
The optional *name* keyword-only argument sets the attribute:
322+
323+
..attribute::name
324+
325+
The name of the variable that was attempted to be accessed.
318326

319327
..versionchanged::3.10
320328
Added the:attr:`name` attribute.
@@ -382,7 +390,7 @@ The following exceptions are the exceptions that are usually raised.
382390

383391
The corresponding error message, as provided by
384392
the operating system. It is formatted by the C
385-
functions:c:func:`perror` under POSIX, and:c:func:`FormatMessage`
393+
functions:c:func:`!perror` under POSIX, and:c:func:`!FormatMessage`
386394
under Windows.
387395

388396
..attribute::filename
@@ -398,7 +406,7 @@ The following exceptions are the exceptions that are usually raised.
398406
..versionchanged::3.3
399407
:exc:`EnvironmentError`,:exc:`IOError`,:exc:`WindowsError`,
400408
:exc:`socket.error`,:exc:`select.error` and
401-
:exc:`mmap.error` have been merged into:exc:`OSError`, and the
409+
:exc:`!mmap.error` have been merged into:exc:`OSError`, and the
402410
constructor may return a subclass.
403411

404412
..versionchanged::3.4
@@ -597,7 +605,7 @@ The following exceptions are the exceptions that are usually raised.
597605
handled, the Python interpreter exits; no stack traceback is printed. The
598606
constructor accepts the same optional argument passed to:func:`sys.exit`.
599607
If the value is an integer, it specifies the system exit status (passed to
600-
C's:c:func:`exit` function); if it is ``None``, the exit status is zero; if
608+
C's:c:func:`!exit` function); if it is ``None``, the exit status is zero; if
601609
it has another type (such as a string), the object's value is printed and
602610
the exit status is one.
603611

‎Doc/library/os.path.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,10 @@ the :mod:`glob` module.)
298298
device than *path*, or whether:file:`{path}/..` and *path* point to the same
299299
i-node on the same device --- this should detect mount points for all Unix
300300
and POSIX variants. It is not able to reliably detect bind mounts on the
301-
same filesystem. On Windows, a drive letter root and a share UNC are
302-
always mount points, and for any other path ``GetVolumePathName`` is called
303-
to see if it is different from the input path.
301+
same filesystem. On Linux systems, it will always return ``True`` for btrfs
302+
subvolumes, even if they aren't mount points. On Windows, a drive letter root
303+
and a share UNC are always mount points, and for any other path
304+
``GetVolumePathName`` is called to see if it is different from the input path.
304305

305306
..versionchanged::3.4
306307
Added support for detecting non-root mount points on Windows.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp