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: Build with Py_LIMITED_API fails unknown type name ‘PyModuleDef_Slot’
Type: compile error Stage: resolved
Components: Build, Interpreter Core Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: vstinner Nosy List: christian.heimes, pablogsal, vstinner
Priority: normal Keywords: 3.11regression

Created on 2022-03-03 21:15 by christian.heimes, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31667 closed christian.heimes, 2022-03-03 21:19
Messages (7)
msg414473 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2022-03-03 21:15
Extension modules with bare "#define Py_LIMITED_API" without version fail to build with error:

   moduleobject.h:82:3: error: unknown type name ‘PyModuleDef_Slot’

The issue was introduced in PR GH-31528 and bpo-45459. The type PyModuleDef_Slot is only defined when Py_LIMITED_API is set to Python 3.5.0 or higher.
msg414474 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2022-03-03 21:15
The problem was first reported to PyCA cryptography project in bug https://github.com/pyca/cryptography/issues/6929
msg414475 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2022-03-03 21:28
With fix:

$ /tmp/python311/bin/pip3 install --no-binary :all: cryptography
Collecting cryptography
  Using cached cryptography-36.0.1.tar.gz (572 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: cffi>=1.12 in /tmp/python311/lib/python3.11/site-packages (from cryptography) (1.15.0)
Requirement already satisfied: pycparser in /tmp/python311/lib/python3.11/site-packages (from cffi>=1.12->cryptography) (2.21)
Building wheels for collected packages: cryptography
  Building wheel for cryptography (PEP 517) ... done
  Created wheel for cryptography: filename=cryptography-36.0.1-cp311-cp311-linux_x86_64.whl size=2628351 sha256=fb3cc21f8eaa546cd2c0123ea01a98bf92a9824fcdca36cfcf765b2c044bd186
  Stored in directory: /home/heimes/.cache/pip/wheels/6c/77/a9/3c4762d4e65bef5f742a304c507f9723ca3563a38d108618ad
Successfully built cryptography
Installing collected packages: cryptography
Successfully installed cryptography-36.0.1


Without fix:

  gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tmp/python311/include/python3.11 -c build/temp.linux-x86_64-3.11/_openssl.c -o build/temp.linux-x86_64-3.11/build/temp.linux-x86_64-3.11/_openssl.o -Wconversion -Wno-error=sign-conversion
  In file included from /tmp/python311/include/python3.11/Python.h:66,
                   from build/temp.linux-x86_64-3.11/_openssl.c:57:
  /tmp/python311/include/python3.11/moduleobject.h:82:3: error: unknown type name ‘PyModuleDef_Slot’
     82 |   PyModuleDef_Slot *m_slots;
        |   ^~~~~~~~~~~~~~~~
msg414476 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-03-03 21:29
I proposed a fix: https://github.com/python/cpython/pull/31668
msg414480 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-03-03 22:07
Fixed by https://github.com/python/cpython/commit/0b63215bb152c06404cecbd5303b1a50969a9f9f
msg414488 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2022-03-03 23:10
Please add a blurb entry.
msg414956 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2022-03-12 00:35
> Fixed by https://github.com/python/cpython/commit/0b63215bb152c06404cecbd5303b1a50969a9f9f

This change is now part of Python 3.11 alpha6 released a few days ago. Python 3.11a6 news entries were merged into the Misc/NEWS.d/3.11.0a6.rst file.

> Please add a blurb entry.

I consider that the changelog is for changes which impacts users when they update. The regression was introduced after 3.11 alpha5 but fixed before Python 3.11 alpha6. Only projects using contiguous integration were impacted. Only the cryptography project was impacted in practice.

> https://github.com/pyca/cryptography/issues/6929

This issue was closed as with the comment:

"Going to close this as it's an upstream python bug that's now been fixed."
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 91071
2022-03-12 00:35:14vstinnersetmessages: + msg414956
2022-03-03 23:10:32christian.heimessetstatus: closed -> open
priority: normal
messages: + msg414488

assignee: christian.heimes -> vstinner
resolution: fixed ->
2022-03-03 22:07:46vstinnersetstatus: open -> closed
priority: release blocker -> (no value)
messages: + msg414480

resolution: fixed
stage: resolved
2022-03-03 21:29:52vstinnersetmessages: + msg414476
2022-03-03 21:28:36christian.heimessetkeywords: - patch

messages: + msg414475
stage: patch review -> (no value)
2022-03-03 21:19:35christian.heimessetkeywords: + patch
stage: patch review
pull_requests: + pull_request29786
2022-03-03 21:15:50christian.heimessetmessages: + msg414474
2022-03-03 21:15:25christian.heimescreate