Skip to content

[3.15] gh-81241: Fix importing ctypes from statically linked interpreters (GH-153890) - #158307

Merged
serhiy-storchaka merged 2 commits into
python:3.15from
miss-islington:backport-5637f4e-3.15
Oct 10, 2026
Merged

serhiy-storchaka merged 2 commits into
python:3.15from
miss-islington:backport-5637f4e-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

@read-the-docs-community

read-the-docs-community Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

@vstinner

vstinner commented Oct 1, 2026

Copy link
Copy Markdown
Member

test_pathlib.test_touch_common() failed twice on "Tests / Emscripten / build and test (pull_request)":

FAIL: test_touch_common (test.test_pathlib.test_pathlib.PathSubclassTest.test_touch_common)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython/Lib/test/test_pathlib/test_pathlib.py", line 2344, in test_touch_common
    self.assertGreaterEqual(st.st_mtime_ns, old_mtime_ns)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1790555994350000000 not greater than or equal to 1790555994351000000

It looks like a flaky test. I just re-run the failed job.

Comment thread Doc/library/ctypes.rst Outdated
:c:expr:`int`, which is of course not always the truth, so you have to assign
the correct :attr:`!restype` attribute to use these functions.

Note that if the Python interpreter is statically linked, this will be

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an AI model look at this because @zanieb asked about it on Discord. The model found that statically linked glibc works here, it's only musl that has this behavior. So it's probably more correct to use "may" here instead of "will"

@jjhelmus

jjhelmus commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

It is a little odd that this fix was included in the 3.13.16 and 3.14.8 releases but was not included in 3.15.0rc3 which was made after these two. Is this fix expected to be included in 3.15.0?

I only ask because in python-build-standalone we include this patch and need to apply it conditionally based on the Python version. Currently is is applied for <=3.12 and 3.15.

@ZeroIntensity

Copy link
Copy Markdown
Member

During the RC phase, changes need approvals from two core devs to make it in. There's only one here (me), so this will have to wait until 3.15.1.

@ngoldbaum

Copy link
Copy Markdown
Contributor

@vstinner

vstinner commented Oct 7, 2026

Copy link
Copy Markdown
Member

I don't think that this bug is major enough to justify landing it after Python 3.15.0rc3. It's fine to wait for 3.15.1 bugfix release.

@serhiy-storchaka
serhiy-storchaka merged commit 3440ff9 into python:3.15 Oct 10, 2026
53 checks passed
@miss-islington
miss-islington deleted the backport-5637f4e-3.15 branch October 10, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants