Bug 2246290

Summary: pyodbc fails to build with Python 3.13: Missing <ctype.h> declaration
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: pyodbcAssignee: Ondřej Sloup <osloup>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 40CC: awilliam, fjanus, fti-bugs, hhorak, ksurma, mhroncok, osloup
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: 2024-06-12 23:23:54 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: 2260875, 2260877, 2244836, 2291576    

Description Karolina Surma 2023-10-26 07:45:47 UTC
pyodbc fails to build with Python 3.13.0a1.

This report is automated and not very verbose, but we'll try to get back here with details.

  src/pyodbc.h: In function ‘void _strlwr(char*)’:
  src/pyodbc.h:102:29: error: ‘tolower’ was not declared in this scope; did you mean ‘totalorder’?
    102 |     while (*name) { *name = tolower(*name); name++; }
        |                             ^~~~~~~
        |                             totalorder

https://docs.python.org/3.13/whatsnew/3.13.html
Python.h no longer includes the <ctype.h> standard header file. If needed, it should now be included explicitly. For example, it provides isalpha() and tolower() functions which are locale dependent. Python provides locale independent functions, like Py_ISALPHA() and Py_TOLOWER(). (Contributed by Victor Stinner in gh-108765.)

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

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

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 Ondřej Sloup 2023-10-29 20:43:35 UTC
Thank you for the message. The pyodbc does not support Python 3.13 yet. Nonetheless, I will try to find a fix. 

Release page
https://github.com/mkleehammer/pyodbc/releases/tag/5.0.0
5.0.0 Release
> This is the first 3.x only pyodbc release, supporting Python 3.8-3.12.

Comment 2 Miro Hrončok 2023-10-30 11:02:12 UTC
For the record:

This is the first pre-release of Python 3.13. We do not expect upstream to "support" Python 3.13. But we report problems like this, os that they can be fixed upstream in time, in order to discover other issues in dependent packages an to "support" Python 3.13 once Fedora 41 updates to it / once Fedora 41 is released.

Comment 3 Aoife Moloney 2024-02-15 23:02:11 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 4 Karolina Surma 2024-06-12 14:57:47 UTC
*** Bug 2291595 has been marked as a duplicate of this bug. ***

Comment 5 Adam Williamson 2024-06-12 22:28:00 UTC
Sent https://github.com/mkleehammer/pyodbc/pull/1361 and built https://bodhi.fedoraproject.org/updates/FEDORA-2024-a0c1c969b4 - this is affecting composes (it breaks the Security spin indirectly, Security includes pcp which needs pyodbc to build) so I wanted it fixed.

Comment 6 Adam Williamson 2024-06-12 23:23:54 UTC
stable now.