8000 Merge branch 'python:main' into ctypes_ready · python/cpython@fb5943b · GitHub
[go: up one dir, main page]

Skip to content

Commit fb5943b

Browse files
authored
Merge branch 'python:main' into ctypes_ready
2 parents c10f4ab + 65f8eb7 commit fb5943b

Some content is hidden

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

56 files changed

+1067
-504
lines changed

Doc/c-api/object.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,8 @@ Object Protocol
4747
4848
.. c:function:: int PyObject_HasAttr(PyObject *o, PyObject *attr_name)
4949
50-
Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. This
51-
is equivalent to the Python expression ``hasattr(o, attr_name)``. This function
52-
always succeeds.
50+
Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise.
51+
This function always succeeds.
5352
5453
.. note::
5554

Doc/library/gc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ The :mod:`gc` module provides the following functions:
9696
.. versionadded:: 3.4
9797

9898

99-
.. function:: set_threshold(threshold0[, threshold1[, threshold2]])
99+
.. function:: set_threshold(threshold0, [threshold1, [threshold2]])
100100

101101
Set the garbage collection thresholds (the collection frequency). Setting
102102
*threshold0* to zero disables collection.

Doc/library/itertools.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ The following recipes have a more mathematical flavor:
11501150
# https://mathworld.wolfram.com/TotientFunction.html
11511151
# totient(12) --> 4 because len([1, 5, 7, 11]) == 4
11521152
for p in unique_justseen(factor(n)):
1153-
n = n // p * (p - 1)
1153+
n -= n // p
11541154
return n
11551155

11561156

Doc/library/string.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,13 @@ The grammar for a replacement field is as follows:
208208

209209
.. productionlist:: format-string
210210
replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
211-
field_name: arg_name ("." `attribute_name` | "[" `element_index` "]")*
212-
arg_name: [`identifier` | `digit`+]
213-
attribute_name: `identifier`
214-
element_index: `digit`+ | `index_string`
211+
field_name: `arg_name` ("." `attribute_name` | "[" `element_index` "]")*
212+
arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+]
213+
attribute_name: `~python-grammar:identifier`
214+
element_index: `~python-grammar:digit`+ | `index_string`
215215
index_string: <any source character except "]"> +
216216
conversion: "r" | "s" | "a"
217-
format_spec: <described in the next section>
217+
format_spec: `format-spec:format_spec`
218218

219219
In less formal terms, the replacement field can start with a *field_name* that specifies
220220
the object whose value is to be formatted and inserted
@@ -316,9 +316,9 @@ The general form of a *standard format specifier* is:
316316
fill: <any character>
317317
align: "<" | ">" | "=" | "^"
318318
sign: "+" | "-" | " "
319-
width: `digit`+
319+
width: `~python-grammar:digit`+
320320
grouping_option: "_" | ","
321-
precision: `digit`+
321+
precision: `~python-grammar:digit`+
322322
type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
323323

324324
If a valid *align* value is specified, it can be preceded by a *fill*

Doc/library/time.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,15 @@ These constants are used as parameters for :func:`clock_getres` and
840840

841841
.. versionadded:: 3.3
842842

843+
.. data:: CLOCK_MONOTONIC_RAW_APPROX
844+
845+
Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by
846+
the system at context switch and hence has less accuracy.
847+
848+
.. availability:: macOS >= 10.12.
849+
850+
.. versionadded:: 3.13
851+
843852

844853
.. data:: CLOCK_PROCESS_CPUTIME_ID
845854

@@ -899,6 +908,15 @@ These constants are used as parameters for :func:`clock_getres` and
899908

900909
.. versionadded:: 3.8
901910

911+
.. data:: CLOCK_UPTIME_RAW_APPROX
912+
913+
Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system
914+
at context switches and therefore has less accuracy.
915+
916+
.. availability:: macOS >= 10.12.
917+
918+
.. versionadded:: 3.13
919+
902920
The following constant is the only parameter that can be sent to
903921
:func:`clock_settime`.
904922

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ Doc/library/smtplib.rst
7777
Doc/library/socket.rst
7878
Doc/library/ssl.rst
7979
Doc/library/stdtypes.rst
80-
Doc/library/string.rst
8180
Doc/library/subprocess.rst
8281
Doc/library/termios.rst
8382
Doc/library/test.rst

Doc/tools/extensions/pyspecific.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
Body.enum.converters['lowerroman'] = \
4949
Body.enum.converters['upperroman'] = lambda x: None
5050

51+
# monkey-patch the productionlist directive to allow hyphens in group names
52+
# https://github.com/sphinx-doc/sphinx/issues/11854
53+
from sphinx.domains import std
54+
55+
std.token_re = re.compile(r'`((~?[\w-]*:)?\w+)`')
5156

5257
# Support for marking up and linking to bugs.python.org issues
5358

Doc/whatsnew/2.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Guidelines":
130130
Read the rest of :pep:`1` for the details of the PEP editorial process, style, and
131131
format. PEPs are kept in the Python CVS tree on SourceForge, though they're not
132132
part of the Python 2.0 distribution, and are also available in HTML form from
133-
https://peps.python.org/. As of September 2000, there are 25 PEPS, ranging
133+
https://peps.python.org/. As of September 2000, there are 25 PEPs, ranging
134134
from :pep:`201`, "Lockstep Iteration", to PEP 225, "Elementwise/Objectwise
135135
Operators".
136136

Doc/whatsnew/2.6.rst

Lines changed: 74 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
What's New in Python 2.6
55
****************************
66

7-
.. XXX add trademark info for Apple, Microsoft, SourceForge.
8-
97
:Author: A.M. Kuchling (amk at amk.ca)
108

119
.. $Id$
@@ -128,7 +126,7 @@ and to C extension code as :c:data:`!Py_Py3kWarningFlag`.
128126
The 3\ *xxx* series of PEPs, which contains proposals for Python 3.0.
129127
:pep:`3000` describes the development process for Python 3.0.
130128
Start with :pep:`3100` that describes the general goals for Python
131-
3.0, and then explore the higher-numbered PEPS that propose
129+
3.0, and then explore the higher-numbered PEPs that propose
132130
specific features.
133131

134132

@@ -1051,8 +1049,6 @@ the :mod:`io` module:
10511049
sockets, but Python 2.6 hasn't restructured its file and socket objects
10521050
in this way.
10531051

1054-
.. XXX should 2.6 register them in io.py?
1055-
10561052
* :class:`BufferedIOBase` is an abstract base class that
10571053
buffers data in memory to reduce the number of
10581054
system calls used, making I/O processing more efficient.
@@ -1133,8 +1129,6 @@ while an external caller could be modifying the contents,
11331129
so there's a corresponding ``PyBuffer_Release(Py_buffer *view)`` to
11341130
indicate that the external caller is done.
11351131

1136-
.. XXX PyObject_GetBuffer not documented in c-api
1137-
11381132
The *flags* argument to :c:func:`PyObject_GetBuffer` specifies
11391133
constraints upon the memory returned. Some examples are:
11401134

@@ -3110,8 +3104,8 @@ Port-Specific Changes: Windows
31103104

31113105
* The :mod:`msvcrt` module now supports
31123106
both the normal and wide char variants of the console I/O
3113-
API. The :func:`getwch` function reads a keypress and returns a Unicode
3114-
value, as does the :func:`getwche` function. The :func:`putwch` function
3107+
API. The :func:`~msvcrt.getwch` function reads a keypress and returns a Unicode
3108+
value, as does the :func:`~msvcrt.getwche` function. The :func:`~msvcrt.putwch` function
31153109
takes a Unicode character and writes it to the console.
31163110
(Contributed by Christian Heimes.)
31173111

@@ -3120,24 +3114,24 @@ Port-Specific Changes: Windows
31203114
directory path. (Contributed by Josiah Carlson; :issue:`957650`.)
31213115

31223116
* The :mod:`socket` module's socket objects now have an
3123-
:meth:`ioctl` method that provides a limited interface to the
3117+
:meth:`~socket.socket.ioctl` method that provides a limited interface to the
31243118
:c:func:`WSAIoctl` system interface.
31253119

3126-
* The :mod:`_winreg` module now has a function,
3127-
:func:`ExpandEnvironmentStrings`,
3120+
* The :mod:`_winreg <winreg>` module now has a function,
3121+
:func:`~winreg.ExpandEnvironmentStrings`,
31283122
that expands environment variable references such as ``%NAME%``
31293123
in an input string. The handle objects provided by this
31303124
module now support the context protocol, so they can be used
31313125
in :keyword:`with` statements. (Contributed by Christian Heimes.)
31323126

3133-
:mod:`_winreg` also has better support for x64 systems,
3134-
exposing the :func:`DisableReflectionKey`, :func:`EnableReflectionKey`,
3135-
and :func:`QueryReflectionKey` functions, which enable and disable
3127+
:mod:`_winreg <winreg>` also has better support for x64 systems,
3128+
exposing the :func:`~winreg.DisableReflectionKey`, :func:`~winreg.EnableReflectionKey`,
3129+
and :func:`~winreg.QueryReflectionKey` functions, which enable and disable
31363130
registry reflection for 32-bit processes running on 64-bit systems.
31373131
(:issue:`1753245`)
31383132

3139-
* The :mod:`!msilib` module's :class:`Record` object
3140-
gained :meth:`GetInteger` and :meth:`GetString` methods that
3133+
* The :mod:`!msilib` module's :class:`!Record` object
3134+
gained :meth:`!GetInteger` and :meth:`!GetString` methods that
31413135
return field values as an integer or a string.
31423136
(Contributed by Floris Bruynooghe; :issue:`2125`.)
31433137

@@ -3151,49 +3145,49 @@ Port-Specific Changes: Mac OS X
31513145
:option:`!--with-framework-name=` option to the
31523146
:program:`configure` script.
31533147

3154-
* The :mod:`macfs` module has been removed. This in turn required the
3155-
:func:`macostools.touched` function to be removed because it depended on the
3156-
:mod:`macfs` module. (:issue:`1490190`)
3148+
* The :mod:`!macfs` module has been removed. This in turn required the
3149+
:func:`!macostools.touched` function to be removed because it depended on the
3150+
:mod:`!macfs` module. (:issue:`1490190`)
31573151

31583152
* Many other Mac OS modules have been deprecated and will be removed in
31593153
Python 3.0:
3160-
:mod:`_builtinSuites`,
3161-
:mod:`aepack`,
3162-
:mod:`aetools`,
3163-
:mod:`aetypes`,
3164-
:mod:`applesingle`,
3165-
:mod:`appletrawmain`,
3166-
:mod:`appletrunner`,
3167-
:mod:`argvemulator`,
3168-
:mod:`Audio_mac`,
3169-
:mod:`autoGIL`,
3170-
:mod:`Carbon`,
3171-
:mod:`cfmfile`,
3172-
:mod:`CodeWarrior`,
3173-
:mod:`ColorPicker`,
3174-
:mod:`EasyDialogs`,
3175-
:mod:`Explorer`,
3176-
:mod:`Finder`,
3177-
:mod:`FrameWork`,
3178-
:mod:`findertools`,
3179-
:mod:`ic`,
3180-
:mod:`icglue`,
3181-
:mod:`icopen`,
3182-
:mod:`macerrors`,
3183-
:mod:`MacOS`,
3184-
:mod:`macfs`,
3185-
:mod:`macostools`,
3186-
:mod:`macresource`,
3187-
:mod:`MiniAEFrame`,
3188-
:mod:`Nav`,
3189-
:mod:`Netscape`,
3190-
:mod:`OSATerminology`,
3191-
:mod:`pimp`,
3192-
:mod:`PixMapWrapper`,
3193-
:mod:`StdSuites`,
3194-
:mod:`SystemEvents`,
3195-
:mod:`Terminal`, and
3196-
:mod:`terminalcommand`.
3154+
:mod:`!_builtinSuites`,
3155+
:mod:`!aepack`,
3156+
:mod:`!aetools`,
3157+
:mod:`!aetypes`,
3158+
:mod:`!applesingle`,
3159+
:mod:`!appletrawmain`,
3160+
:mod:`!appletrunner`,
3161+
:mod:`!argvemulator`,
3162+
:mod:`!Audio_mac`,
3163+
:mod:`!autoGIL`,
3164+
:mod:`!Carbon`,
3165+
:mod:`!cfmfile`,
3166+
:mod:`!CodeWarrior`,
3167+
:mod:`!ColorPicker`,
3168+
:mod:`!EasyDialogs`,
3169+
:mod:`!Explorer`,
3170+
:mod:`!Finder`,
3171+
:mod:`!FrameWork`,
3172+
:mod:`!findertools`,
3173+
:mod:`!ic`,
3174+
:mod:`!icglue`,
3175+
:mod:`!icopen`,
3176+
:mod:`!macerrors`,
3177+
:mod:`!MacOS`,
3178+
:mod:`!macfs`,
3179+
:mod:`!macostools`,
3180+
:mod:`!macresource`,
3181+
:mod:`!MiniAEFrame`,
3182+
:mod:`!Nav`,
3183+
:mod:`!Netscape`,
3184+
:mod:`!OSATerminology`,
3185+
:mod:`!pimp`,
3186+
:mod:`!PixMapWrapper`,
3187+
:mod:`!StdSuites`,
3188+
:mod:`!SystemEvents`,
3189+
:mod:`!Terminal`, and
3190+
:mod:`!terminalcommand`.
31973191

31983192
.. ======================================================================
31993193
@@ -3202,29 +3196,29 @@ Port-Specific Changes: IRIX
32023196

32033197
A number of old IRIX-specific modules were deprecated and will
32043198
be removed in Python 3.0:
3205-
:mod:`al` and :mod:`AL`,
3206-
:mod:`cd`,
3207-
:mod:`cddb`,
3208-
:mod:`cdplayer`,
3209-
:mod:`CL` and :mod:`cl`,
3210-
:mod:`DEVICE`,
3211-
:mod:`ERRNO`,
3212-
:mod:`FILE`,
3213-
:mod:`FL` and :mod:`fl`,
3214-
:mod:`flp`,
3215-
:mod:`fm`,
3216-
:mod:`GET`,
3217-
:mod:`GLWS`,
3218-
:mod:`GL` and :mod:`gl`,
3219-
:mod:`IN`,
3220-
:mod:`IOCTL`,
3221-
:mod:`jpeg`,
3222-
:mod:`panelparser`,
3223-
:mod:`readcd`,
3224-
:mod:`SV` and :mod:`sv`,
3225-
:mod:`torgb`,
3226-
:mod:`videoreader`, and
3227-
:mod:`WAIT`.
3199+
:mod:`!al` and :mod:`!AL`,
3200+
:mod:`!cd`,
3201+
:mod:`!cddb`,
3202+
:mod:`!cdplayer`,
3203+
:mod:`!CL` and :mod:`!cl`,
3204+
:mod:`!DEVICE`,
3205+
:mod:`!ERRNO`,
3206+
:mod:`!FILE`,
3207+
:mod:`!FL` and :mod:`!fl`,
3208+
:mod:`!flp`,
3209+
:mod:`!fm`,
3210+
:mod:`!GET`,
3211+
:mod:`!GLWS`,
3212+
:mod:`!GL` and :mod:`!gl`,
3213+
:mod:`!IN`,
3214+
:mod:`!IOCTL`,
3215+
:mod:`!jpeg`,
3216+
:mod:`!panelparser`,
3217+
:mod:`!readcd`,
3218+
:mod:`!SV` and :mod:`!sv`,
3219+
:mod:`!torgb`,
3220+
:mod:`!videoreader`, and
3221+
:mod:`!WAIT`.
32283222

32293223
.. ======================================================================
32303224

Include/internal/pycore_global_objects_fini_generated.h

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_global_strings.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,6 @@ struct _Py_global_strings {
653653
STRUCT_FOR_ID(seek)
654654
STRUCT_FOR_ID(seekable)
655655
STRUCT_FOR_ID(selectors)
656-
STRUCT_FOR_ID(self)
657656
STRUCT_FOR_ID(send)
658657
STRUCT_FOR_ID(sep)
659658
STRUCT_FOR_ID(sequence)

Include/internal/pycore_runtime_init_generated.h

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_unicodeobject_generated.h

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

Lib/asyncio/futures.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ def _make_cancelled_error(self):
138138
exc = exceptions.CancelledError()
139139
else:
140140
exc = exceptions.CancelledError(self._cancel_message)
141-
exc.__context__ = self._cancelled_exc
142-
# Remove the reference since we don't need this anymore.
143-
self._cancelled_exc = None
144141
return exc
145142

146143
def cancel(self, msg=None):

0 commit comments

Comments
 (0)
0