Bug 2208211

Summary: python-wxpython4 fails to build with Python 3.12: error: PyUnicode_GET_SIZE was not declared in this scope
Product: [Fedora] Fedora Reporter: Tomáš Hrnčiar <thrnciar>
Component: python-wxpython4Assignee: Scott Talbert <swt>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mhroncok, swt, thrnciar
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-06-19 20:04:13 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: 2135404    

Description Tomáš Hrnčiar 2023-05-18 09:39:03 UTC
I've tried to report this on sip mailing list, but I don't know if the message reached it because I can't see it on mailing list archive.

python-wxpython4 fails to build with Python 3.12.0a7.

../../../../sip/cpp/sip_corewxArrayString.cpp: In function ‘int convertTo_wxArrayString(PyObject*, void**, int*, PyObject*)’:
../../../../sip/cpp/sip_corewxArrayString.cpp:91:26: error: ‘PyUnicode_GET_SIZE’ was not declared in this scope; did you mean ‘PyDict_GET_SIZE’?
   91 |             size_t len = PyUnicode_GET_SIZE(item);
      |                          ^~~~~~~~~~~~~~~~~~
      |                          PyDict_GET_SIZE

This happens because of a change in CPython, where PyUnicode_GET_SIZE() was removed.

From what's new:
    Legacy Unicode APIs have 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/05903515-python-wxpython4/

For all our attempts to build python-wxpython4 with Python 3.12, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.12/package/python-wxpython4/

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 Scott Talbert 2023-05-18 13:03:08 UTC
(In reply to Tomáš Hrnčiar from comment #0)
> I've tried to report this on sip mailing list, but I don't know if the
> message reached it because I can't see it on mailing list archive.

I believe you have to be a subscriber in order to post to the mailing list.

> python-wxpython4 fails to build with Python 3.12.0a7.
> 
> ../../../../sip/cpp/sip_corewxArrayString.cpp: In function ‘int
> convertTo_wxArrayString(PyObject*, void**, int*, PyObject*)’:
> ../../../../sip/cpp/sip_corewxArrayString.cpp:91:26: error:
> ‘PyUnicode_GET_SIZE’ was not declared in this scope; did you mean
> ‘PyDict_GET_SIZE’?
>    91 |             size_t len = PyUnicode_GET_SIZE(item);
>       |                          ^~~~~~~~~~~~~~~~~~
>       |                          PyDict_GET_SIZE

sip doesn't call PyUnicode_GET_SIZE, this is in some non-generated code in wxPython.  Reassigning.  I'll take a look later.

Comment 2 Scott Talbert 2023-06-13 19:22:24 UTC
I have a fix available for this particular issue, but a doxygen update in Rawhide has caused another FTBFS for wxPython.  Still working on those.