Skip to content

Commit a58dd3c

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-10-19)
Summary: Imported python/cpython `3.16.0a1+dev` from upstream rev [`999855b`](https://www.github.com/python/cpython/commit/999855b07f9b795ca88ac3349060a06c116a1037) (committed 2026-10-19 04:46:36+00:00). # Commit Info - Base: (`3.16.0a1+dev`) - [`010bebb`](https://www.github.com/python/cpython/commit/010bebbf9fd12bba1e3f40bdbddacd51a9c2bf20) (commit date: 2026-10-17 03:24:12+00:00) - Imported: (`3.16.0a1+dev`) - [`999855b`](https://www.github.com/python/cpython/commit/999855b07f9b795ca88ac3349060a06c116a1037) (commit date: 2026-10-19 04:46:36+00:00) # Noteworthy file changes - Low-signal files (7 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GLCFyzK-68s3fRkFANUd_690KDBKbr0LAAAz Reviewed By: itamaro Differential Revision: D126009430 fbshipit-source-id: 406e54a0982b45995d9a37fec580405a725635c2
1 parent a7d8d3e commit a58dd3c

55 files changed

Lines changed: 1038 additions & 284 deletions

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: 3 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -491,53 +491,6 @@ jobs:
491491
if: fromJSON(needs.build-context.outputs.run-tests)
492492
uses: ./.github/workflows/reusable-test-lazy-imports-all.yml
493493

494-
build-asan:
495-
name: 'Address sanitizer'
496-
runs-on: ${{ matrix.os }}
497-
timeout-minutes: 60
498-
needs: build-context
499-
if: needs.build-context.outputs.run-ubuntu == 'true'
500-
strategy:
501-
fail-fast: false
502-
matrix:
503-
os: [ubuntu-26.04]
504-
env:
505-
OPENSSL_VER: 3.5.9
506-
PYTHONSTRICTEXTENSIONBUILD: 1
507-
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
508-
steps:
509-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
510-
with:
511-
persist-credentials: false
512-
- name: Runner image version
513-
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
514-
- name: Register gcc problem matcher
515-
run: echo "::add-matcher::.github/problem-matchers/gcc.json"
516-
- name: Install dependencies
517-
run: sudo ./.github/workflows/posix-deps-apt.sh
518-
- name: Configure OpenSSL env vars
519-
run: |
520-
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
521-
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> "$GITHUB_ENV"
522-
echo "LD_LIBRARY_PATH=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}/lib" >> "$GITHUB_ENV"
523-
- name: 'Restore OpenSSL build'
524-
id: cache-openssl
525-
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
526-
with:
527-
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
528-
key: ${{ matrix.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
529-
- name: Install OpenSSL
530-
if: steps.cache-openssl.outputs.cache-hit != 'true'
531-
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory "$MULTISSL_DIR" --openssl "$OPENSSL_VER" --system Linux
532-
- name: Configure CPython
533-
run: ./configure --config-cache --with-address-sanitizer --without-pymalloc --with-openssl="$OPENSSL_DIR"
534-
- name: Build CPython
535-
run: make -j4
536-
- name: Display build info
537-
run: make pythoninfo
538-
- name: Tests
539-
run: xvfb-run make ci
540-
541494
build-san:
542495
# ${{ '' } is a hack to nest jobs under the same sidebar category.
543496
name: Sanitizers${{ '' }} # zizmor: ignore[obfuscation]
@@ -554,6 +507,9 @@ jobs:
554507
sanitizer:
555508
- TSan
556509
include:
510+
- check-name: Address
511+
sanitizer: ASan
512+
free-threading: false
557513
- check-name: Undefined behavior
558514
sanitizer: UBSan
559515
free-threading: false
@@ -667,7 +623,6 @@ jobs:
667623
- build-wasi
668624
- test-hypothesis
669625
- test-lazy-imports-all
670-
- build-asan
671626
- build-san
672627
- cross-build-linux
673628
- cifuzz
@@ -714,7 +669,6 @@ jobs:
714669
build-ubuntu-installed,
715670
build-ubuntu-ssltests,
716671
test-hypothesis,
717-
build-asan,
718672
build-san,
719673
cross-build-linux,
720674
'

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

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@ jobs:
4343
# please update the versions in `Tools/pixi-packages/variants.yaml` too.
4444
echo "CC=clang" >> "$GITHUB_ENV"
4545
echo "CXX=clang++" >> "$GITHUB_ENV"
46+
- name: ASan option setup
47+
if: inputs.sanitizer == 'ASan'
48+
run: |
49+
echo "MULTISSL_DIR=${GITHUB_WORKSPACE}/multissl" >> "$GITHUB_ENV"
50+
echo "OPENSSL_DIR=${GITHUB_WORKSPACE}/multissl/openssl/${OPENSSL_VER}" >> "$GITHUB_ENV"
51+
echo "ASAN_OPTIONS=${SAN_LOG_OPTION} detect_leaks=0 allocator_may_return_null=1 handle_segv=0" >> "$GITHUB_ENV"
52+
echo "PYTHONSTRICTEXTENSIONBUILD=1" >> "$GITHUB_ENV"
53+
env:
54+
SAN_LOG_OPTION: log_path=${{ github.workspace }}/san_log
4655
- name: TSan option setup
4756
if: inputs.sanitizer == 'TSan'
4857
run: |
@@ -88,24 +97,27 @@ jobs:
8897
- name: Add ccache to PATH
8998
run: |
9099
echo "PATH=/usr/lib/ccache:$PATH" >> "$GITHUB_ENV"
91-
- name: 'Restore OpenSSL build (TSan)'
100+
- name: 'Restore OpenSSL build'
92101
id: cache-openssl
93-
if: inputs.sanitizer == 'TSan'
102+
if: inputs.sanitizer == 'TSan' || inputs.sanitizer == 'ASan'
94103
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
95104
with:
96105
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
97-
key: ${{ env.IMAGE_OS_VERSION }}-multissl-openssl-tsan-${{ env.OPENSSL_VER }}
98-
- name: Install OpenSSL (TSan)
106+
key: >-
107+
${{ env.IMAGE_OS_VERSION }}-multissl-openssl-${{
108+
inputs.sanitizer == 'TSan' && 'tsan-' || ''
109+
}}${{ env.OPENSSL_VER }}
110+
- name: Install OpenSSL
99111
if: >-
100-
inputs.sanitizer == 'TSan'
112+
(inputs.sanitizer == 'TSan' || inputs.sanitizer == 'ASan')
101113
&& steps.cache-openssl.outputs.cache-hit != 'true'
102114
run: >-
103115
python3 Tools/ssl/multissltests.py
104116
--steps=library
105117
--base-directory="${MULTISSL_DIR}"
106118
--openssl="${OPENSSL_VER}"
107119
--system=Linux
108-
--tsan
120+
${{ inputs.sanitizer == 'TSan' && '--tsan' || '' }}
109121
# gh-157958: -O2 instead of the pydebug default -Og to avoid a clang 21
110122
# compile-time blowup on some interpreter files.
111123
# (https://github.com/llvm/llvm-project/issues/179695)
@@ -117,14 +129,20 @@ jobs:
117129
--config-cache
118130
OPT="-O2 -g"
119131
${{
120-
inputs.sanitizer == 'TSan'
132+
inputs.sanitizer == 'ASan'
133+
&& '--with-address-sanitizer --without-pymalloc'
134+
|| inputs.sanitizer == 'TSan'
121135
&& '--with-thread-sanitizer'
122136
|| inputs.sanitizer == 'MSan'
123137
&& '--with-memory-sanitizer'
124138
|| '--with-undefined-behavior-sanitizer --with-strict-overflow'
125139
}}
126140
${{ inputs.sanitizer == 'MSan' && '--with-assertions' || '--with-pydebug' }}
127-
${{ inputs.sanitizer == 'TSan' && '--with-openssl="$OPENSSL_DIR" --with-openssl-rpath=auto' || '' }}
141+
${{
142+
(inputs.sanitizer == 'TSan' || inputs.sanitizer == 'ASan')
143+
&& '--with-openssl="$OPENSSL_DIR" --with-openssl-rpath=auto'
144+
|| ''
145+
}}
128146
${{ inputs.free-threading && '--disable-gil' || '' }}
129147
- name: Build CPython
130148
run: make -j4

‎Doc/library/dbm.rst‎

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ The :meth:`!setdefault` method requires two arguments.
100100

101101
Key and values are always stored as :class:`bytes`. This means that when
102102
strings are used they are implicitly converted to the default encoding before
103-
being stored.
103+
being stored. For detailed information about accepted types, see
104+
:ref:`dbm-key-value-types`.
104105

105106
These objects also support being used in a :keyword:`with` statement, which
106107
will automatically close them when done.
@@ -121,6 +122,47 @@ will automatically close them when done.
121122
:meth:`!clear` methods are now available for all :mod:`!dbm` backends.
122123

123124

125+
.. _dbm-key-value-types:
126+
127+
Key and value types
128+
-------------------
129+
130+
The accepted types for keys and values vary by backend. Keys and values are
131+
handled the same way, except where noted below:
132+
133+
* **Traditional backends:**
134+
135+
* :mod:`dbm.gnu` and :mod:`dbm.ndbm`: Accept :class:`str` and :class:`bytes`
136+
objects.
137+
* :mod:`dbm.dumb`: Accepts :class:`str` and :class:`bytes` objects;
138+
:class:`bytearray` is acceptable as a value, but not as a key.
139+
140+
* **SQLite backend** (:mod:`dbm.sqlite3`): Accepts :class:`str`, :class:`bytes`,
141+
:class:`int`, :class:`float`, :class:`bool`, :class:`bytearray`,
142+
:class:`memoryview`, and :class:`array.array` objects.
143+
144+
**Storage format:**
145+
146+
All keys and values are stored as :class:`bytes` objects in the database.
147+
When retrieving, you'll always get bytes back, regardless of the original
148+
type stored.
149+
150+
**Type conversion examples:**
151+
152+
* ``db['key'] = 'string'`` stored as ``b'string'``
153+
* ``db['key'] = bytearray(b'data')`` stored as ``b'data'``
154+
(:mod:`dbm.dumb` and :mod:`dbm.sqlite3` only)
155+
* ``db['key'] = 42`` stored as ``b'42'`` (:mod:`dbm.sqlite3` only)
156+
* ``db['key'] = 3.14`` stored as ``b'3.14'`` (:mod:`dbm.sqlite3` only)
157+
* ``db['key'] = True`` stored as ``b'1'`` (:mod:`dbm.sqlite3` only)
158+
* ``db['key'] = False`` stored as ``b'0'`` (:mod:`dbm.sqlite3` only)
159+
* ``db['key'] = memoryview(b'data')`` stored as ``b'data'``
160+
(:mod:`dbm.sqlite3` only)
161+
* ``db['key'] = array.array('i', [1, 2, 3])`` stored as bytes (for example, on
162+
little-endian: ``b'\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'``)
163+
(:mod:`dbm.sqlite3` only)
164+
165+
124166
The following example records some hostnames and a corresponding title, and
125167
then prints out the contents of the database::
126168

@@ -142,8 +184,9 @@ then prints out the contents of the database::
142184
# Often-used methods of the dict interface work too.
143185
print(db.get('python.org', b'not present'))
144186

145-
# Storing a non-string key or value will raise an exception (most
146-
# likely a TypeError).
187+
# Storing a non-string key or value behavior depends on the backend:
188+
# - Traditional backends (ndbm, gnu, dumb) will raise a TypeError
189+
# - The sqlite3 backend accepts it and converts to bytes
147190
db['www.yahoo.com'] = 4
148191

149192
# db is automatically closed when leaving the with statement.

‎Doc/library/mailbox.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ accessing and manipulating on-disk mailboxes and the messages they contain.
1515
:class:`~email.message.Message` class with format-specific state and behavior.
1616
Supported mailbox formats are Maildir, mbox, MH, Babyl, and MMDF.
1717

18+
.. warning::
19+
20+
The :mod:`!mailbox` module is designed for use in trusted environments,
21+
where data from untrusted sources is never passed to the module's API
22+
calls and only trusted users have access to the filesystems accessible
23+
to the module.
1824

1925
.. seealso::
2026

‎Doc/library/traceback.rst‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ The module's API can be divided into two parts:
4444
necessary for later formatting without holding references to actual exception
4545
and traceback objects.
4646

47-
.. versionadded:: 3.13
48-
Output is colorized by default and can be
49-
:ref:`controlled using environment variables <using-on-controlling-color>`.
50-
5147

5248
Module-Level Functions
5349
----------------------

‎Include/errcode.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ extern "C" {
3838
#define E_BADSINGLE 27 /* Ill-formed single statement input */
3939
#define E_INTERACT_STOP 28 /* Interactive mode stopped tokenization */
4040
#define E_COLUMNOVERFLOW 29 /* Column offset overflow */
41+
#define E_INCOMPLETE 30 /* An unfinished token in partial input */
4142

4243
#ifdef __cplusplus
4344
}

‎Include/internal/pycore_parser.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,17 @@ _Py_DECLARE_STR(empty, "")
2727
}, \
2828
}
2929

30+
/* The caller must initialize *incomplete to NULL if supplied. A returned AST
31+
can also return an owned exception there for a missing line terminator.
32+
Validate the AST before reporting that exception. */
3033
extern struct _mod* _PyParser_ASTFromString(
3134
const char *str,
3235
PyObject* filename,
3336
int mode,
3437
PyCompilerFlags *flags,
3538
PyArena *arena,
36-
PyObject *module);
39+
PyObject *module,
40+
PyObject **incomplete);
3741

3842
extern struct _mod* _PyParser_ASTFromFile(
3943
FILE *fp,

‎Lib/asyncio/base_events.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,7 @@ async def _create_connection_transport(
12441244
await waiter
12451245
except:
12461246
transport.close()
1247+
waiter = None
12471248
raise
12481249

12491250
return transport, protocol
@@ -1381,6 +1382,7 @@ async def start_tls(self, transport, protocol, sslcontext, *,
13811382
transport.close()
13821383
conmade_cb.cancel()
13831384
resume_cb.cancel()
1385+
waiter = None
13841386
raise
13851387

13861388
return ssl_protocol._app_transport

‎Lib/asyncio/selector_events.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,7 @@ def _call_connection_lost(self, exc):
12251225
super()._call_connection_lost(exc)
12261226
finally:
12271227
self._write_ready = None
1228+
self._read_ready_cb = None
12281229
if self._empty_waiter is not None:
12291230
self._empty_waiter.set_exception(
12301231
ConnectionError("Connection is closed by peer"))

‎Lib/codeop.py‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,10 @@ def _maybe_compile(compiler, source, filename, symbol, flags):
6262
warnings.simplefilter("ignore", (SyntaxWarning, DeprecationWarning))
6363
try:
6464
compiler(source, filename, symbol, flags=flags)
65+
except _IncompleteInputError:
66+
return None
6567
except SyntaxError: # Let other compile() errors propagate.
66-
try:
67-
compiler(source + "\n", filename, symbol, flags=flags)
68-
return None
69-
except _IncompleteInputError:
70-
return None
71-
except SyntaxError:
72-
pass
73-
# fallthrough
68+
pass
7469

7570
return compiler(source, filename, symbol, incomplete_input=False)
7671

0 commit comments

Comments
 (0)