Skip to content

Commit 764873a

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pythongh-121996-two-options
2 parents 558813e + bc264ea commit 764873a

179 files changed

Lines changed: 3200 additions & 2152 deletions

File tree

Some content is hidden

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

‎.github/workflows/build.yml‎

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -242,33 +242,20 @@ jobs:
242242
os-matrix: '["ghcr.io/cirruslabs/macos-runner:sonoma", "macos-14"]'
243243

244244
build_ubuntu:
245-
name: 'Ubuntu'
246-
needs: check_source
247-
if: needs.check_source.outputs.run_tests == 'true'
248-
uses: ./.github/workflows/reusable-ubuntu.yml
249-
with:
250-
config_hash: ${{ needs.check_source.outputs.config_hash }}
251-
options: |
252-
../cpython-ro-srcdir/configure \
253-
--config-cache \
254-
--with-pydebug \
255-
--enable-slower-safety \
256-
--with-openssl=$OPENSSL_DIR
257-
258-
build_ubuntu_free_threading:
259-
name: 'Ubuntu (free-threading)'
245+
name: >-
246+
Ubuntu
247+
${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }}
260248
needs: check_source
261249
if: needs.check_source.outputs.run_tests == 'true'
250+
strategy:
251+
matrix:
252+
free-threading:
253+
- false
254+
- true
262255
uses: ./.github/workflows/reusable-ubuntu.yml
263256
with:
264257
config_hash: ${{ needs.check_source.outputs.config_hash }}
265-
options: |
266-
../cpython-ro-srcdir/configure \
267-
--config-cache \
268-
--with-pydebug \
269-
--enable-slower-safety \
270-
--with-openssl=$OPENSSL_DIR \
271-
--disable-gil
258+
free-threading: ${{ matrix.free-threading }}
272259

273260
build_ubuntu_ssltests:
274261
name: 'Ubuntu SSL tests with OpenSSL'
@@ -581,7 +568,6 @@ jobs:
581568
- build_macos
582569
- build_macos_free_threading
583570
- build_ubuntu
584-
- build_ubuntu_free_threading
585571
- build_ubuntu_ssltests
586572
- build_wasi
587573
- build_windows
@@ -616,7 +602,6 @@ jobs:
616602
build_macos,
617603
build_macos_free_threading,
618604
build_ubuntu,
619-
build_ubuntu_free_threading,
620605
build_ubuntu_ssltests,
621606
build_wasi,
622607
build_windows,

‎.github/workflows/reusable-ubuntu.yml‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ on:
44
config_hash:
55
required: true
66
type: string
7-
options:
8-
required: true
9-
type: string
7+
free-threading:
8+
description: Whether to use free-threaded mode
9+
required: false
10+
type: boolean
11+
default: false
1012

1113
jobs:
1214
build_ubuntu_reusable:
@@ -63,7 +65,12 @@ jobs:
6365
key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}
6466
- name: Configure CPython out-of-tree
6567
working-directory: ${{ env.CPYTHON_BUILDDIR }}
66-
run: ${{ inputs.options }}
68+
run: >-
69+
../cpython-ro-srcdir/configure
70+
--config-cache
71+
--with-pydebug
72+
--with-openssl=$OPENSSL_DIR
73+
${{ fromJSON(inputs.free-threading) && '--disable-gil' || '' }}
6774
- name: Build CPython out-of-tree
6875
working-directory: ${{ env.CPYTHON_BUILDDIR }}
6976
run: make -j4

‎.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: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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/pyspecific.py",
10+
]
11+
12+
[lint]
13+
preview = true
14+
select = [
15+
"C4", # flake8-comprehensions
16+
"B", # flake8-bugbear
17+
"E", # pycodestyle
18+
"F", # pyflakes
19+
"FA", # flake8-future-annotations
20+
"FLY", # flynt
21+
"FURB", # refurb
22+
"G", # flake8-logging-format
23+
"I", # isort
24+
"LOG", # flake8-logging
25+
"N", # pep8-naming
26+
"PERF", # perflint
27+
"PGH", # pygrep-hooks
28+
"PT", # flake8-pytest-style
29+
"TCH", # flake8-type-checking
30+
"UP", # pyupgrade
31+
"W", # pycodestyle
32+
]
33+
ignore = [
34+
"E501", # Ignore line length errors (we use auto-formatting)
35+
]
36+
37+
[format]
38+
preview = true
39+
quote-style = "preserve"
40+
docstring-code-format = true
41+
exclude = [
42+
"tools/extensions/lexers/*",
43+
]

‎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/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/init_config.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ PyConfig
509509
The :c:func:`PyConfig_Read` function only parses
510510
:c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv`
511511
is set to ``2`` after arguments are parsed. Since Python arguments are
512-
strippped from :c:member:`PyConfig.argv`, parsing arguments twice would
512+
stripped from :c:member:`PyConfig.argv`, parsing arguments twice would
513513
parse the application options as Python options.
514514
515515
:ref:`Preinitialize Python <c-preinit>` if needed.
@@ -1041,7 +1041,7 @@ PyConfig
10411041
The :c:func:`PyConfig_Read` function only parses
10421042
:c:member:`PyConfig.argv` arguments once: :c:member:`PyConfig.parse_argv`
10431043
is set to ``2`` after arguments are parsed. Since Python arguments are
1044-
strippped from :c:member:`PyConfig.argv`, parsing arguments twice would
1044+
stripped from :c:member:`PyConfig.argv`, parsing arguments twice would
10451045
parse the application options as Python options.
10461046
10471047
Default: ``1`` in Python mode, ``0`` in isolated mode.

‎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)