Skip to content

Commit 0240115

Browse files
committed
Merge branch 'main' into tier-2-tos-caching
2 parents 3d72871 + 9731dd2 commit 0240115

File tree

69 files changed

+4002
-2304
lines changed

Some content is hidden

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

69 files changed

+4002
-2304
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,14 @@ jobs:
527527
config_hash: ${{ needs.build-context.outputs.config-hash }}
528528
free-threading: ${{ matrix.free-threading }}
529529

530+
build-ubsan:
531+
name: Undefined behavior sanitizer
532+
needs: build-context
533+
if: needs.build-context.outputs.run-tests == 'true'
534+
uses: ./.github/workflows/reusable-ubsan.yml
535+
with:
536+
config_hash: ${{ needs.build-context.outputs.config-hash }}
537+
530538
cross-build-linux:
531539
name: Cross build Linux
532540
runs-on: ubuntu-latest

.github/workflows/reusable-ubsan.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Reusable Undefined Behavior Sanitizer
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
config_hash:
7+
required: true
8+
type: string
9+
10+
env:
11+
FORCE_COLOR: 1
12+
13+
jobs:
14+
build-ubsan-reusable:
15+
name: 'Undefined behavior sanitizer'
16+
runs-on: ubuntu-24.04
17+
timeout-minutes: 60
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
persist-credentials: false
22+
- name: Runner image version
23+
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
24+
- name: Restore config.cache
25+
uses: actions/cache@v4
26+
with:
27+
path: config.cache
28+
key: ${{ github.job }}-${{ env.IMAGE_OS_VERSION }}-${{ inputs.config_hash }}
29+
- name: Install dependencies
30+
run: |
31+
sudo ./.github/workflows/posix-deps-apt.sh
32+
# Install clang-20
33+
wget https://apt.llvm.org/llvm.sh
34+
chmod +x llvm.sh
35+
sudo ./llvm.sh 20
36+
- name: UBSAN option setup
37+
run: |
38+
echo "UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1" >> "$GITHUB_ENV"
39+
echo "CC=clang" >> "$GITHUB_ENV"
40+
echo "CXX=clang++" >> "$GITHUB_ENV"
41+
- name: Add ccache to PATH
42+
run: |
43+
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
44+
- name: Configure ccache action
45+
uses: hendrikmuhs/[email protected]
46+
with:
47+
save: ${{ github.event_name == 'push' }}
48+
max-size: "200M"
49+
- name: Configure CPython
50+
run: >-
51+
./configure
52+
--config-cache
53+
--with-undefined-behavior-sanitizer
54+
--with-pydebug
55+
- name: Set up UBSAN log after configuration
56+
run: |
57+
echo "UBSAN_OPTIONS=${UBSAN_OPTIONS}:log_path=${GITHUB_WORKSPACE}/ubsan_log" >> "$GITHUB_ENV"
58+
- name: Build CPython
59+
run: make -j4
60+
- name: Display build info
61+
run: make pythoninfo
62+
- name: Tests
63+
run: ./python -m test -j4
64+
- name: Display UBSAN logs
65+
if: always()
66+
run: find "${GITHUB_WORKSPACE}" -name 'ubsan_log.*' | xargs head -n 1000
67+
- name: Archive UBSAN logs
68+
if: always()
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: >-
72+
ubsan-logs
73+
path: ubsan_log.*
74+
if-no-files-found: ignore

Doc/c-api/refcounting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ of Python objects.
210210
211211
Py_SETREF(dst, src);
212212
213-
That arranges to set *dst* to *src* _before_ releasing the reference
213+
That arranges to set *dst* to *src* *before* releasing the reference
214214
to the old value of *dst*, so that any code triggered as a side-effect
215215
of *dst* getting torn down no longer believes *dst* points
216216
to a valid object.

Doc/c-api/type.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ Type Objects
282282
and other places where a method's defining class cannot be passed using the
283283
:c:type:`PyCMethod` calling convention.
284284
285+
The returned reference is :term:`borrowed <borrowed reference>` from *type*,
286+
and will be valid as long as you hold a reference to *type*.
287+
Do not release it with :c:func:`Py_DECREF` or similar.
288+
285289
.. versionadded:: 3.11
286290
287291
.. c:function:: int PyType_GetBaseByToken(PyTypeObject *type, void *token, PyTypeObject **result)

Doc/data/refcounts.dat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,6 +2385,10 @@ PyType_GetFlags:PyTypeObject*:type:0:
23852385
PyType_GetName:PyObject*::+1:
23862386
PyType_GetName:PyTypeObject*:type:0:
23872387

2388+
PyType_GetModuleByDef:PyObject*::0:
2389+
PyType_GetModuleByDef:PyTypeObject*:type:0:
2390+
PyType_GetModuleByDef:PyModuleDef*:def::
2391+
23882392
PyType_GetQualName:PyObject*::+1:
23892393
PyType_GetQualName:PyTypeObject*:type:0:
23902394

Doc/library/concurrent.futures.rst

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ Each worker's interpreter is isolated from all the other interpreters.
265265
"Isolated" means each interpreter has its own runtime state and
266266
operates completely independently. For example, if you redirect
267267
:data:`sys.stdout` in one interpreter, it will not be automatically
268-
redirected any other interpreter. If you import a module in one
268+
redirected to any other interpreter. If you import a module in one
269269
interpreter, it is not automatically imported in any other. You
270270
would need to import the module separately in interpreter where
271271
you need it. In fact, each module imported in an interpreter is
@@ -287,7 +287,7 @@ efficient alternative is to serialize with :mod:`pickle` and then send
287287
the bytes over a shared :mod:`socket <socket>` or
288288
:func:`pipe <os.pipe>`.
289289

290-
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=(), shared=None)
290+
.. class:: InterpreterPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
291291

292292
A :class:`ThreadPoolExecutor` subclass that executes calls asynchronously
293293
using a pool of at most *max_workers* threads. Each thread runs
@@ -304,32 +304,17 @@ the bytes over a shared :mod:`socket <socket>` or
304304
and *initargs* using :mod:`pickle` when sending them to the worker's
305305
interpreter.
306306

307-
.. note::
308-
Functions defined in the ``__main__`` module cannot be pickled
309-
and thus cannot be used.
310-
311307
.. note::
312308
The executor may replace uncaught exceptions from *initializer*
313309
with :class:`~concurrent.futures.interpreter.ExecutionFailed`.
314310

315-
The optional *shared* argument is a :class:`dict` of objects that all
316-
interpreters in the pool share. The *shared* items are added to each
317-
interpreter's ``__main__`` module. Not all objects are shareable.
318-
Shareable objects include the builtin singletons, :class:`str`
319-
and :class:`bytes`, and :class:`memoryview`. See :pep:`734`
320-
for more info.
321-
322311
Other caveats from parent :class:`ThreadPoolExecutor` apply here.
323312

324313
:meth:`~Executor.submit` and :meth:`~Executor.map` work like normal,
325314
except the worker serializes the callable and arguments using
326315
:mod:`pickle` when sending them to its interpreter. The worker
327316
likewise serializes the return value when sending it back.
328317

329-
.. note::
330-
Functions defined in the ``__main__`` module cannot be pickled
331-
and thus cannot be used.
332-
333318
When a worker's current task raises an uncaught exception, the worker
334319
always tries to preserve the exception as-is. If that is successful
335320
then it also sets the ``__cause__`` to a corresponding

Doc/library/dis.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,14 +1094,6 @@ iterations of the loop.
10941094
.. versionadded:: 3.14
10951095

10961096

1097-
.. opcode:: LOAD_CONST_IMMORTAL (consti)
1098-
1099-
Pushes ``co_consts[consti]`` onto the stack.
1100-
Can be used when the constant value is known to be immortal.
1101-
1102-
.. versionadded:: 3.14
1103-
1104-
11051097
.. opcode:: LOAD_NAME (namei)
11061098

11071099
Pushes the value associated with ``co_names[namei]`` onto the stack.

Doc/library/logging.config.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ configuration dictionary for the handler named ``foo``, and later (once that
586586
handler has been configured) it points to the configured handler instance.
587587
Thus, ``cfg://handlers.foo`` could resolve to either a dictionary or a handler
588588
instance. In general, it is wise to name handlers in a way such that dependent
589-
handlers are configured _after_ any handlers they depend on; that allows
589+
handlers are configured *after* any handlers they depend on; that allows
590590
something like ``cfg://handlers.foo`` to be used in configuring a handler that
591591
depends on handler ``foo``. If that dependent handler were named ``bar``,
592592
problems would result, because the configuration of ``bar`` would be attempted

Doc/library/shutil.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ Directory and files operations
327327
The deprecated *onerror* is similar to *onexc*, except that the third
328328
parameter it receives is the tuple returned from :func:`sys.exc_info`.
329329

330+
.. seealso::
331+
:ref:`shutil-rmtree-example` for an example of handling the removal
332+
of a directory tree that contains read-only files.
333+
330334
.. audit-event:: shutil.rmtree path,dir_fd shutil.rmtree
331335

332336
.. versionchanged:: 3.3

Doc/library/sqlite3.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,15 @@ Module constants
507507
Version number of the runtime SQLite library as a :class:`tuple` of
508508
:class:`integers <int>`.
509509

510+
.. data:: SQLITE_KEYWORDS
511+
512+
A :class:`tuple` containing all sqlite3 keywords.
513+
514+
This constant is only available if Python was compiled with SQLite
515+
3.24.0 or greater.
516+
517+
.. versionadded:: next
518+
510519
.. data:: threadsafety
511520

512521
Integer constant required by the DB-API 2.0, stating the level of thread

Doc/reference/datamodel.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ Booleans (:class:`bool`)
262262
a string, the strings ``"False"`` or ``"True"`` are returned, respectively.
263263

264264

265+
.. _datamodel-float:
266+
265267
:class:`numbers.Real` (:class:`float`)
266268
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
267269

Doc/reference/expressions.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ Literals
134134
Python supports string and bytes literals and various numeric literals:
135135

136136
.. productionlist:: python-grammar
137-
literal: `stringliteral` | `bytesliteral`
138-
: | `integer` | `floatnumber` | `imagnumber`
137+
literal: `stringliteral` | `bytesliteral` | `NUMBER`
139138

140139
Evaluation of a literal yields an object of the given type (string, bytes,
141140
integer, floating-point number, complex number) with the given value. The value

0 commit comments

Comments
 (0)