Skip to content

Commit 9a7350d

Browse files
authored
Merge branch 'main' into pythongh-120973-fix-local-clear
2 parents 0e9a0bc + a1df1b4 commit 9a7350d

File tree

189 files changed

+3507
-2352
lines changed

Some content is hidden

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

189 files changed

+3507
-2352
lines changed

.github/workflows/reusable-tsan.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ jobs:
3636
# Install clang-18
3737
wget https://apt.llvm.org/llvm.sh
3838
chmod +x llvm.sh
39-
sudo ./llvm.sh 18
40-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-18 100
41-
sudo update-alternatives --set clang /usr/bin/clang-18
42-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-18 100
43-
sudo update-alternatives --set clang++ /usr/bin/clang++-18
39+
sudo ./llvm.sh 17 # gh-121946: llvm-18 package is temporarily broken
40+
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100
41+
sudo update-alternatives --set clang /usr/bin/clang-17
42+
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100
43+
sudo update-alternatives --set clang++ /usr/bin/clang++-17
4444
# Reduce ASLR to avoid TSAN crashing
4545
sudo sysctl -w vm.mmap_rnd_bits=28
4646
- name: TSAN Option Setup

.pre-commit-config.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ repos:
33
rev: v0.3.4
44
hooks:
55
- id: ruff
6-
name: Run Ruff on Lib/test/
6+
name: Run Ruff (lint) on Doc/
7+
args: [--exit-non-zero-on-fix]
8+
files: ^Doc/
9+
- id: ruff
10+
name: Run Ruff (lint) on Lib/test/
711
args: [--exit-non-zero-on-fix]
812
files: ^Lib/test/
913
- id: ruff
10-
name: Run Ruff on Argument Clinic
14+
name: Run Ruff (lint) on Argument Clinic
1115
args: [--exit-non-zero-on-fix, --config=Tools/clinic/.ruff.toml]
1216
files: ^Tools/clinic/|Lib/test/test_clinic.py
17+
- id: ruff-format
18+
name: Run Ruff (format) on Doc/
19+
args: [--check]
20+
files: ^Doc/
1321

1422
- repo: https://github.com/psf/black-pre-commit-mirror
1523
rev: 24.4.2

Doc/.ruff.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
target-version = "py312" # Align with the version in oldest_supported_sphinx
2+
fix = true
3+
output-format = "full"
4+
line-length = 79
5+
extend-exclude = [
6+
"includes/*",
7+
# Temporary exclusions:
8+
"tools/extensions/escape4chm.py",
9+
"tools/extensions/patchlevel.py",
10+
"tools/extensions/pyspecific.py",
11+
]
12+
13+
[lint]
14+
preview = true
15+
select = [
16+
"C4", # flake8-comprehensions
17+
"B", # flake8-bugbear
18+
"E", # pycodestyle
19+
"F", # pyflakes
20+
"FA", # flake8-future-annotations
21+
"FLY", # flynt
22+
"FURB", # refurb
23+
"G", # flake8-logging-format
24+
"I", # isort
25+
"LOG", # flake8-logging
26+
"N", # pep8-naming
27+
"PERF", # perflint
28+
"PGH", # pygrep-hooks
29+
"PT", # flake8-pytest-style
30+
"TCH", # flake8-type-checking
31+
"UP", # pyupgrade
32+
"W", # pycodestyle
33+
]
34+
ignore = [
35+
"E501", # Ignore line length errors (we use auto-formatting)
36+
]
37+
38+
[format]
39+
preview = true
40+
quote-style = "preserve"
41+
docstring-code-format = true
42+
exclude = [
43+
"tools/extensions/lexers/*",
44+
]

Doc/c-api/arg.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ Numbers
280280
length 1, to a C :c:expr:`int`.
281281

282282
``f`` (:class:`float`) [float]
283-
Convert a Python floating point number to a C :c:expr:`float`.
283+
Convert a Python floating-point number to a C :c:expr:`float`.
284284

285285
``d`` (:class:`float`) [double]
286-
Convert a Python floating point number to a C :c:expr:`double`.
286+
Convert a Python floating-point number to a C :c:expr:`double`.
287287

288288
``D`` (:class:`complex`) [Py_complex]
289289
Convert a Python complex number to a C :c:type:`Py_complex` structure.
@@ -642,10 +642,10 @@ Building values
642642
object of length 1.
643643
644644
``d`` (:class:`float`) [double]
645-
Convert a C :c:expr:`double` to a Python floating point number.
645+
Convert a C :c:expr:`double` to a Python floating-point number.
646646
647647
``f`` (:class:`float`) [float]
648-
Convert a C :c:expr:`float` to a Python floating point number.
648+
Convert a C :c:expr:`float` to a Python floating-point number.
649649
650650
``D`` (:class:`complex`) [Py_complex \*]
651651
Convert a C :c:type:`Py_complex` structure to a Python complex number.

Doc/c-api/complex.rst

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ pointers. This is consistent throughout the API.
2525
2626
The C structure which corresponds to the value portion of a Python complex
2727
number object. Most of the functions for dealing with complex number objects
28-
use structures of this type as input or output values, as appropriate. It is
29-
defined as::
28+
use structures of this type as input or output values, as appropriate.
29+
30+
.. c:member:: double real
31+
double imag
32+
33+
The structure is defined as::
3034

3135
typedef struct {
32-
double real;
33-
double imag;
36+
double real;
37+
double imag;
3438
} Py_complex;
3539

3640

@@ -106,11 +110,13 @@ Complex Numbers as Python Objects
106110
.. c:function:: PyObject* PyComplex_FromCComplex(Py_complex v)
107111
108112
Create a new Python complex number object from a C :c:type:`Py_complex` value.
113+
Return ``NULL`` with an exception set on error.
109114
110115
111116
.. c:function:: PyObject* PyComplex_FromDoubles(double real, double imag)
112117
113118
Return a new :c:type:`PyComplexObject` object from *real* and *imag*.
119+
Return ``NULL`` with an exception set on error.
114120
115121
116122
.. c:function:: double PyComplex_RealAsDouble(PyObject *op)
@@ -121,7 +127,9 @@ Complex Numbers as Python Objects
121127
:meth:`~object.__complex__` method, this method will first be called to
122128
convert *op* to a Python complex number object. If :meth:`!__complex__` is
123129
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
124-
returns its result. Upon failure, this method returns ``-1.0``, so one
130+
returns its result.
131+
132+
Upon failure, this method returns ``-1.0`` with an exception set, so one
125133
should call :c:func:`PyErr_Occurred` to check for errors.
126134
127135
.. versionchanged:: 3.13
@@ -135,8 +143,10 @@ Complex Numbers as Python Objects
135143
:meth:`~object.__complex__` method, this method will first be called to
136144
convert *op* to a Python complex number object. If :meth:`!__complex__` is
137145
not defined then it falls back to call :c:func:`PyFloat_AsDouble` and
138-
returns ``0.0`` on success. Upon failure, this method returns ``-1.0``, so
139-
one should call :c:func:`PyErr_Occurred` to check for errors.
146+
returns ``0.0`` on success.
147+
148+
Upon failure, this method returns ``-1.0`` with an exception set, so one
149+
should call :c:func:`PyErr_Occurred` to check for errors.
140150
141151
.. versionchanged:: 3.13
142152
Use :meth:`~object.__complex__` if available.
@@ -149,8 +159,11 @@ Complex Numbers as Python Objects
149159
method, this method will first be called to convert *op* to a Python complex
150160
number object. If :meth:`!__complex__` is not defined then it falls back to
151161
:meth:`~object.__float__`. If :meth:`!__float__` is not defined then it falls back
152-
to :meth:`~object.__index__`. Upon failure, this method returns ``-1.0`` as a real
153-
value.
162+
to :meth:`~object.__index__`.
163+
164+
Upon failure, this method returns :c:type:`Py_complex`
165+
with :c:member:`~Py_complex.real` set to ``-1.0`` and with an exception set, so one
166+
should call :c:func:`PyErr_Occurred` to check for errors.
154167
155168
.. versionchanged:: 3.8
156169
Use :meth:`~object.__index__` if available.

Doc/c-api/float.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
.. _floatobjects:
44

5-
Floating Point Objects
5+
Floating-Point Objects
66
======================
77

8-
.. index:: pair: object; floating point
8+
.. index:: pair: object; floating-point
99

1010

1111
.. c:type:: PyFloatObject
1212
13-
This subtype of :c:type:`PyObject` represents a Python floating point object.
13+
This subtype of :c:type:`PyObject` represents a Python floating-point object.
1414

1515

1616
.. c:var:: PyTypeObject PyFloat_Type
1717
18-
This instance of :c:type:`PyTypeObject` represents the Python floating point
18+
This instance of :c:type:`PyTypeObject` represents the Python floating-point
1919
type. This is the same object as :class:`float` in the Python layer.
2020

2121

@@ -45,7 +45,7 @@ Floating Point Objects
4545
.. c:function:: double PyFloat_AsDouble(PyObject *pyfloat)
4646
4747
Return a C :c:expr:`double` representation of the contents of *pyfloat*. If
48-
*pyfloat* is not a Python floating point object but has a :meth:`~object.__float__`
48+
*pyfloat* is not a Python floating-point object but has a :meth:`~object.__float__`
4949
method, this method will first be called to convert *pyfloat* into a float.
5050
If :meth:`!__float__` is not defined then it falls back to :meth:`~object.__index__`.
5151
This method returns ``-1.0`` upon failure, so one should call

Doc/c-api/marshal.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Numeric values are stored with the least significant byte first.
1515

1616
The module supports two versions of the data format: version 0 is the
1717
historical version, version 1 shares interned strings in the file, and upon
18-
unmarshalling. Version 2 uses a binary format for floating point numbers.
18+
unmarshalling. Version 2 uses a binary format for floating-point numbers.
1919
``Py_MARSHAL_VERSION`` indicates the current file format (currently 2).
2020

2121

Doc/c-api/module.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ The available slot types are:
342342
The *value* pointer of this slot must point to a function of the signature:
343343
344344
.. c:function:: PyObject* create_module(PyObject *spec, PyModuleDef *def)
345-
:noindex:
345+
:no-index-entry:
346+
:no-contents-entry:
346347
347348
The function receives a :py:class:`~importlib.machinery.ModuleSpec`
348349
instance, as defined in :PEP:`451`, and the module definition.
@@ -377,7 +378,8 @@ The available slot types are:
377378
The signature of the function is:
378379
379380
.. c:function:: int exec_module(PyObject* module)
380-
:noindex:
381+
:no-index-entry:
382+
:no-contents-entry:
381383
382384
If multiple ``Py_mod_exec`` slots are specified, they are processed in the
383385
order they appear in the *m_slots* array.

Doc/c-api/number.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ Number Protocol
5151
5252
Return a reasonable approximation for the mathematical value of *o1* divided by
5353
*o2*, or ``NULL`` on failure. The return value is "approximate" because binary
54-
floating point numbers are approximate; it is not possible to represent all real
55-
numbers in base two. This function can return a floating point value when
54+
floating-point numbers are approximate; it is not possible to represent all real
55+
numbers in base two. This function can return a floating-point value when
5656
passed two integers. This is the equivalent of the Python expression ``o1 / o2``.
5757
5858
@@ -177,8 +177,8 @@ Number Protocol
177177
178178
Return a reasonable approximation for the mathematical value of *o1* divided by
179179
*o2*, or ``NULL`` on failure. The return value is "approximate" because binary
180-
floating point numbers are approximate; it is not possible to represent all real
181-
numbers in base two. This function can return a floating point value when
180+
floating-point numbers are approximate; it is not possible to represent all real
181+
numbers in base two. This function can return a floating-point value when
182182
passed two integers. The operation is done *in-place* when *o1* supports it.
183183
This is the equivalent of the Python statement ``o1 /= o2``.
184184

0 commit comments

Comments
 (0)