Bug 2245658

Summary: python3-typed_ast fails to build with Python 3.13: error: implicit declaration of function `_Py_IDENTIFIER`, `lseek`, `_PyObject_CallMethodId`, `PyId_open`, `_PyObject_GetAttrId`, `PyId_readline`
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python3-typed_astAssignee: Gwyn Ciesla <gwync>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: gwync, ksurma, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-10-23 17:54:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2244836    

Description Karolina Surma 2023-10-23 13:26:20 UTC
python3-typed_ast fails to build with Python 3.13.0a1.

ast27/Parser/tokenizer.c:483:5: error: implicit declaration of function ‘_Py_IDENTIFIER’ [-Werror=implicit-function-declaration]
  483 |     _Py_IDENTIFIER(open);
      |     ^~~~~~~~~~~~~~
ast27/Parser/tokenizer.c:483:20: error: ‘open’ undeclared (first use in this function); did you mean ‘popen’?
  483 |     _Py_IDENTIFIER(open);
      |                    ^~~~
      |                    popen
<snip>
ast27/Parser/tokenizer.c:500:9: error: implicit declaration of function ‘lseek’; did you mean ‘fseek’? [-Werror=implicit-function-declaration]
  500 |         lseek(fd, (off_t)(pos > 0 ? pos - 1 : pos), SEEK_SET) == (off_t)-1) {
      |         ^~~~~
      |         fseek
ast27/Parser/tokenizer.c:505:14: error: implicit declaration of function ‘_PyObject_CallMethodId’; did you mean ‘PyObject_CallMethod’? [-Werror=implicit-function-declaration]
  505 |     stream = _PyObject_CallMethodId(io, &PyId_open, "isisOOO",
      |              ^~~~~~~~~~~~~~~~~~~~~~
      |              PyObject_CallMethod
ast27/Parser/tokenizer.c:505:42: error: ‘PyId_open’ undeclared (first use in this function)
  505 |     stream = _PyObject_CallMethodId(io, &PyId_open, "isisOOO",
      |                                          ^~~~~~~~~
ast27/Parser/tokenizer.c:511:16: error: implicit declaration of function ‘_PyObject_GetAttrId’; did you mean ‘PyObject_GetAttr’? [-Werror=implicit-function-declaration]
  511 |     readline = _PyObject_GetAttrId(stream, &PyId_readline);
      |                ^~~~~~~~~~~~~~~~~~~
      |                PyObject_GetAttr
ast27/Parser/tokenizer.c:511:45: error: ‘PyId_readline’ undeclared (first use in this function); did you mean ‘PyOS_Readline’?
  511 |     readline = _PyObject_GetAttrId(stream, &PyId_readline);
      |                                             ^~~~~~~~~~~~~
      |                                             PyOS_Readline

Partial list of identified issues:
- _Py_IDENTIFIER has been removed from Python 3.13.
The detailed list of the removed private C API functions can be found here:
https://github.com/python/cpython/issues/106320

- Python.h no longer includes the <unistd.h> standard header file. If needed, it should now be included explicitly. For example, it provides the functions: read(), write(), close(), isatty(), lseek(), getpid(), getcwd(), sysconf() and getpagesize(). As a consequence, _POSIX_SEMAPHORES and _POSIX_THREADS macros are no longer defined by Python.h. The HAVE_UNISTD_H and HAVE_PTHREAD_H macros defined by Python.h can be used to decide if <unistd.h> and <pthread.h> header files can be included. (Contributed by Victor Stinner in gh-108765.)


https://docs.python.org/3.13/whatsnew/3.13.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06546844-python3-typed_ast/

For all our attempts to build python3-typed_ast with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python3-typed_ast/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Gwyn Ciesla 2023-10-23 17:54:14 UTC
No longer needed, retired.

Comment 2 Miro Hrončok 2023-10-23 21:23:52 UTC
In that case: https://src.fedoraproject.org/rpms/python3-mypy/pull-request/3