Bug 2155256 - pyodbc fails to build with Python 3.12: error: PyUnicode_FromUnicode was not declared in this scope
Summary: pyodbc fails to build with Python 3.12: error: PyUnicode_FromUnicode was not ...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: pyodbc
Version: 39
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Filip Januš
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 2220088 (view as bug list)
Depends On:
Blocks: PYTHON3.12 F39FTBFS F39FailsToInstall 2220522 F40FailsToInstall, RAWHIDEFailsToInstall F40FTBFS, RAWHIDEFTBFS 2220062 2220523
TreeView+ depends on / blocked
 
Reported: 2022-12-20 14:20 UTC by Tomáš Hrnčiar
Modified: 2023-08-16 07:06 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github mkleehammer pyodbc issues 917 0 None open Deprecated PyUnicode functions that must be updated 2023-07-10 21:41:12 UTC

Description Tomáš Hrnčiar 2022-12-20 14:20:43 UTC
pyodbc fails to build with Python 3.12.0a3.

src/pyodbccompat.h: In function ‘PyObject* Text_New(Py_ssize_t)’:
src/pyodbccompat.h:75:12: error: ‘PyUnicode_FromUnicode’ was not declared in this scope; did you mean ‘PyUnicode_FromString’?
   75 |     return PyUnicode_FromUnicode(0, length);
      |            ^~~~~~~~~~~~~~~~~~~~~
      |            PyUnicode_FromString
src/pyodbccompat.h: In function ‘Py_UNICODE* Text_Buffer(PyObject*)’:
src/pyodbccompat.h:86:12: error: ‘PyUnicode_AS_UNICODE’ was not declared in this scope; did you mean ‘PyUnicode_AsUCS4’?
   86 |     return PyUnicode_AS_UNICODE(o);
      |            ^~~~~~~~~~~~~~~~~~~~
      |            PyUnicode_AsUCS4
src/pyodbccompat.h: In function ‘Py_ssize_t Text_Size(PyObject*)’:
src/pyodbccompat.h:126:40: error: ‘PyUnicode_GET_SIZE’ was not declared in this scope; did you mean ‘PyDict_GET_SIZE’?
  126 |     return (o && PyUnicode_Check(o)) ? PyUnicode_GET_SIZE(o) : 0;
      |                                        ^~~~~~~~~~~~~~~~~~
      |                                        PyDict_GET_SIZE
src/pyodbccompat.h: In function ‘Py_ssize_t TextCopyToUnicode(Py_UNICODE*, PyObject*)’:
src/pyodbccompat.h:146:26: error: ‘PyUnicode_GET_SIZE’ was not declared in this scope; did you mean ‘PyDict_GET_SIZE’?
  146 |         Py_ssize_t cch = PyUnicode_GET_SIZE(o);
      |                          ^~~~~~~~~~~~~~~~~~
      |                          PyDict_GET_SIZE
src/pyodbccompat.h:147:24: error: ‘PyUnicode_AS_UNICODE’ was not declared in this scope; did you mean ‘PyUnicode_AsUCS4’?
  147 |         memcpy(buffer, PyUnicode_AS_UNICODE(o), cch * sizeof(Py_UNICODE));
      |                        ^~~~~~~~~~~~~~~~~~~~
      |                        PyUnicode_AsUCS4

Leagcy Unicode APIs has been removed. See PEP 623 for detail.
        PyUnicode_WCHAR_KIND
        PyUnicode_AS_UNICODE()
        PyUnicode_AsUnicode()
        PyUnicode_AsUnicodeAndSize()
        PyUnicode_AS_DATA()
        PyUnicode_FromUnicode()
        PyUnicode_GET_SIZE()
        PyUnicode_GetSize()
        PyUnicode_GET_DATA_SIZE()

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

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

For all our attempts to build pyodbc with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/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.12:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/

Let us know here if you have any questions.

Python 3.12 is planned to be included in Fedora 39. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.12.
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 Ben Cotton 2023-02-07 15:03:39 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle.
Changing version to 38.

Comment 2 Miro Hrončok 2023-07-10 21:39:11 UTC
*** Bug 2220088 has been marked as a duplicate of this bug. ***

Comment 3 Filip Januš 2023-07-11 06:49:55 UTC
It's a known issue and upstream seems to be working on it.
https://github.com/mkleehammer/pyodbc/issues/917

Comment 4 Orion Poplawski 2023-07-18 02:04:52 UTC
I'm not sure how much upstream is really working on it.  I've asked for a status update.

Comment 5 Fedora Fails To Install 2023-07-19 04:52:40 UTC
Hello,

Please note that this comment was generated automatically by https://pagure.io/releng/blob/main/f/scripts/ftbfs-fti/follow-policy.py
If you feel that this output has mistakes, please open an issue at https://pagure.io/releng/

This package fails to install and maintainers are advised to take one of the following actions:

 - Fix this bug and close this bugzilla once the update makes it to the repository.
   (The same script that posted this comment will eventually close this bugzilla
   when the fixed package reaches the repository, so you don't have to worry about it.)

or

 - Move this bug to ASSIGNED if you plan on fixing this, but simply haven't done so yet.

or

 - Orphan the package if you no longer plan to maintain it.


If you do not take one of these actions, the process at https://docs.fedoraproject.org/en-US/fesco/Fails_to_build_from_source_Fails_to_install/#_package_removal_for_long_standing_ftbfs_and_fti_bugs will continue.
This package may be orphaned in 7+ weeks.
This is the first reminder (step 3) from the policy.

Don't hesitate to ask for help on devel.org if you are unsure how to fix this bug.

Comment 6 Fedora Release Engineering 2023-08-16 07:06:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.


Note You need to log in before you can comment on or make changes to this bug.