Bug 2220920 - python-urwid broken with Python 3.12: PyUnicode_AS_UNICODE has been removed
Summary: python-urwid broken with Python 3.12: PyUnicode_AS_UNICODE has been removed
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-urwid
Version: 39
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Tomas Tomecek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.12 2217400 2220621 2226500
TreeView+ depends on / blocked
 
Reported: 2023-07-06 14:12 UTC by Ankur Sinha (FranciscoD)
Modified: 2023-09-05 10:25 UTC (History)
2 users (show)

Fixed In Version: python-urwid-2.1.2-10.fc40
Clone Of:
Environment:
Last Closed: 2023-09-05 10:25:27 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github urwid urwid issues 583 0 None open Python 3.12: `PyUnicode_AS_UNICODE` has been removed 2023-07-06 14:12:23 UTC

Description Ankur Sinha (FranciscoD) 2023-07-06 14:12:08 UTC
In Python 3.12, PyUnicdeo_AS_UNICODE has been removed:

https://peps.python.org/pep-0623/#python-3-12

It's still used in https://github.com/urwid/urwid/blob/f7d2f2f6a8a519bd64ebbe1895e5c6b5948199f3/source/str_util.c



Attempting to build urwid will give errors of this form:

gcc ... -fPIC -I/usr/include/python3.12 -c source/str_util.c -o
build/temp.linux-x86_64-cpython-312/source/str_util.o
source/str_util.c: In function ‘Py_IsWideChar’:
source/str_util.c:484:16: warning: implicit declaration of function
‘PyUnicode_AS_UNICODE’; did you mean ‘PyUnicode_AsUCS4’?
[-Wimplicit-function-declaration]
  484 |         ustr = PyUnicode_AS_UNICODE(text);
      |                ^~~~~~~~~~~~~~~~~~~~
      |                PyUnicode_AsUCS4
source/str_util.c:484:14: warning: assignment to ‘Py_UNICODE *’ {aka
‘int *’} from ‘int’ makes pointer from integer without a cast
[-Wint-conversion]
  484 |         ustr = PyUnicode_AS_UNICODE(text);
      |              ^
source/str_util.c: In function ‘Py_CalcWidth’:
source/str_util.c:663:14: warning: assignment to ‘Py_UNICODE *’ {aka
‘int *’} from ‘int’ makes pointer from integer without a cast
[-Wint-conversion]
  663 |         ustr = PyUnicode_AS_UNICODE(text);
      |              ^
source/str_util.c: In function ‘Py_CalcTextPos’:
source/str_util.c:749:14: warning: assignment to ‘Py_UNICODE *’ {aka
‘int *’} from ‘int’ makes pointer from integer without a cast
[-Wint-conversion]
  749 |         ustr = PyUnicode_AS_UNICODE(text);
      |              ^


Reproducible: Always




Affects: python-urwid-2.1.2-9.fc39

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

Comment 2 Ankur Sinha (FranciscoD) 2023-09-04 15:32:23 UTC
A fix is now available (and looks simple enough to carry the patch):

https://github.com/urwid/urwid/pull/598/files


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