Skip to content

Commit 2c2bd2f

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython 3.15 branch from GitHub (2026-10-06)
Summary: Imported python/cpython `3.15.0rc3+dev` from upstream rev [`6fae227`](https://www.github.com/python/cpython/commit/6fae227c51f4457796c9e9f4088efe8c0a517682) (committed 2026-10-06 13:47:00+00:00). # Commit Info - Base: (`3.15.0rc3+dev`) - [`c49b3dc`](https://www.github.com/python/cpython/commit/c49b3dc3cdd0ec20aeee697a5bc37c634b5f2820) (commit date: 2026-10-05 17:15:41+00:00) - Imported: (`3.15.0rc3+dev`) - [`6fae227`](https://www.github.com/python/cpython/commit/6fae227c51f4457796c9e9f4088efe8c0a517682) (commit date: 2026-10-06 13:47:00+00:00) Differential Revision: D123805300 fbshipit-source-id: 726b4dbfc7081db1f6c8192c486729c78f30677b
1 parent 9e3353b commit 2c2bd2f

2 files changed

Lines changed: 42 additions & 9 deletions

File tree

‎Doc/howto/abi3t-migration.rst‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ Module export hook
217217

218218
Unless you've done this step already, your extension module defines a
219219
:ref:`module initialization function <extension-pyinit>`
220-
named :samp:`PyInit_{<module_name>}`.
220+
named :samp:`PyInit_{<modname>}` (where ``modname`` is the name of your module).
221221
You will need to port it to a :ref:`module export hook <extension-export-hook>`,
222-
:samp:`PyModExport_{<module name>}`, a feature added in CPython 3.15 in
222+
:samp:`PyModExport_{<modname>}`, a feature added in CPython 3.15 in
223223
:pep:`793`.
224224

225225
Your existing init function should look like this (with your own names
@@ -297,6 +297,34 @@ pointer to static data.
297297
If you cannot avoid additional code, refer to the
298298
:ref:`caveats in PyModExport documentation <pymodexport-api-caveats>`.
299299

300+
.. note::
301+
302+
When building for Windows using the Setuptools_ build tool,
303+
removing the :samp:`PyInit_{<modname>}` function may result in the linker error
304+
:samp:`LINK : error LNK2001: unresolved external symbol PyInit_{<modname>}`.
305+
This is caused by Setuptools passing an ``/EXPORT`` linker flag, which
306+
is redundant since Python 3.15 (see :gh:`141671`).
307+
A workaround is to add a dummy :samp:`PyInit_{<modname>}` function
308+
to your code.
309+
Python 3.15+ will never call this function if
310+
:samp:`PyModExport_{<modname>}` is present, so it can always fail:
311+
312+
.. code-block:: c
313+
314+
// Workaround for https://github.com/pypa/distutils/issues/387
315+
PyMODINIT_FUNC
316+
PyInit_<modname>(void)
317+
{
318+
PyErr_SetString(PyExc_SystemError,
319+
"PyInit_* called for module with PyModExport_*");
320+
return NULL;
321+
}
322+
323+
(This issue is present in Setuptools 84.0.0; it might be fixed in newer
324+
versions.)
325+
326+
.. _Setuptools: https://setuptools.pypa.io/
327+
300328

301329
Existing slots
302330
--------------

‎Lib/test/test_android.py‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io
2+
import platform
23
import queue
34
import re
45
import subprocess
@@ -16,6 +17,11 @@
1617
if sys.platform != "android":
1718
raise unittest.SkipTest("Android-specific")
1819

20+
# Some API levels filter out consecutive identical lines and replace them with a
21+
# "chatty" marker.
22+
api_level = platform.android_ver().api_level
23+
chatty_issue = (26 <= api_level <= 30)
24+
1925
# (name, level, fileno)
2026
STREAM_INFO = [("stdout", "I", 1), ("stderr", "W", 2)]
2127

@@ -174,15 +180,13 @@ def write(s, lines=None, *, write_len=None):
174180
write("\u0000b", [r"\xc0\x80b"])
175181
write("a\u0000b", [r"a\xc0\x80b"])
176182

177-
# Multi-line messages. Avoid identical consecutive lines, as
178-
# they may activate "chatty" filtering and break the tests.
179-
#
180-
# Additional spaces will appear in the output where necessary to
181-
# protect leading newlines.
183+
# Multi-line messages. Additional spaces will appear in the output where
184+
# necessary to protect leading newlines.
182185
write("\nx", [" "])
183186
write("\na\n", ["x", "a"])
184187
write("\n", [" "])
185-
write("\n\n", [" ", " "])
188+
if not chatty_issue:
189+
write("\n\n", [" ", " "])
186190
write("b\n", ["b"])
187191
write("c\n\n", ["c", " "])
188192
write("d\ne", ["d"])
@@ -201,7 +205,8 @@ def write(s, lines=None, *, write_len=None):
201205
write("\nx", [" ", "x"])
202206
write("\na\n", [" ", "a"])
203207
write("\n", [" "])
204-
write("\n\n", [" ", " "])
208+
if not chatty_issue:
209+
write("\n\n", [" ", " "])
205210
write("b\n", ["b"])
206211
write("c\n\n", ["c", " "])
207212
write("d\ne", ["d", "e"])

0 commit comments

Comments
 (0)