This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tools/scripts/stable_abi.py should also check PC/python3dll.c (Windows stable ABI)
Type: Stage: resolved
Components: C API Versions: Python 3.10
process
Status: closed Resolution: fixed
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 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24639 closed shihai1991, 2021-02-24 16:16
Messages (4)
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/stable_abi.py 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:

PC/python3dll.c

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

https://docs.python.org/3/c-api/stable.html

And in PEP 384:

https://www.python.org/dev/peps/pep-0384/

```
msg398305 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-07-27 15:39
Since PEP 652, PC/python3dll.c is generated from the stable ABI definition.
Checking (i.e. running the tool without --generate) ensures it is up-to-date.
History
Date User Action Args
2022-04-11 14:59:41adminsetgithub: 87401
2021-07-27 15:39:11petr.viktorinsetstatus: open -> closed
resolution: fixed
messages: + msg398305

stage: patch review -> resolved
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