Skip to content

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

Open
miss-islington wants to merge 2 commits into
python:3.15from
miss-islington:backport-5637f4e-3.15
Open

miss-islington wants to merge 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

…eters (pythonGH-153890)

See astral-sh/python-build-standalone#873.
(cherry picked from commit 5637f4e)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
@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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants