Title: Tools/scripts/ should also check PC/python3dll.c (Windows stable ABI)
Type: Stage: patch review
Components: C API Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: pablogsal, petr.viktorin, shihai1991, steve.dower, vstinner
Priority: normal Keywords: patch

Created on 2021-02-16 00:13 by vstinner, last changed 2021-02-24 16:20 by shihai1991.

Pull Requests
URL Status Linked Edit
PR 24639 open shihai1991, 2021-02-24 16:16
Messages (3)
msg387073 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-02-16 00:13
bpo-43155 is just yet another example that we always forget to export symbols of the stable ABI on Windows.

It would be great to have a tool to check that all symbols exported on Unix are also exported on Windows.

Tools/scripts/ could check PC/python3dll.c (Windows stable ABI). For example, currently "PyCMethod_New" symbol is in Doc/data/stable_abi.dat but miss in PC/python3dll.c.
msg387080 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-02-16 00:29
I want to address this in PEP 652.
msg387629 - (view) Author: hai shi (shihai1991) * (Python triager) Date: 2021-02-24 16:20
> It would be great to have a tool to check that all symbols exported on Unix are also exported on Windows.

I write a demo in PR 24639(compare the stable_abi.dat to python3dll.c).
And the output result:
Some symbols from the limited API on windows are missing:
PyMarshal_WriteObjectToFile, PyThread_allocate_lock, PyObject_GC_IsFinalized, PyThread_ReInitTLS, PyThread_acquire_lock, PyThread_GetInfo, PyDictRevIterValue_Type, PyThread_get_thread_native_id, PyThread_start_new_thread, PyThread_set_stacksize, PyDictRevIterKey_Type, PyOS_AfterFork_Child, PyThread_create_key, PyThread_get_thread_ident, PyOS_BeforeFork, Py_BytesMain, PyThread_get_key_value, PyCodec_Unregister, PyInterpreterState_Get, PyMember_GetOne, PyThread_init_thread, PyInterpreterState_GetDict, PyThread_set_key_value, PyThread_delete_key, PyMarshal_WriteObjectToString, PyOS_AfterFork_Parent, PyThread_delete_key_value, PyObject_GC_IsTracked, PyMarshal_ReadObjectFromString, PyMarshal_WriteLongToFile, PyThread_exit_thread, PyThread_acquire_lock_timed, PyThread_get_stacksize, PyMember_SetOne, PyDictRevIterItem_Type, PyThread_free_lock, PyThread_release_lock

This error normally means that there are some missing symbols on windows.

Check if this was a mistake and if not, update the file containing the limited
API symbols. This file is located at:


You can read more about the limited API and its contracts at:

And in PEP 384:

Date User Action Args
2021-02-24 16:20:06shihai1991setmessages: + msg387629
2021-02-24 16:16:09shihai1991setkeywords: + patch
nosy: + shihai1991

pull_requests: + pull_request23424
stage: patch review
2021-02-16 00:29:20petr.viktorinsetmessages: + msg387080
2021-02-16 00:17:00vstinnersetnosy: + steve.dower
2021-02-16 00:16:52vstinnersetnosy: + petr.viktorin, pablogsal
2021-02-16 00:13:30vstinnercreate