Skip to content

Python 3.12: PyUnicode_AS_UNICODE has been removed #583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 3 tasks
sanjayankur31 opened this issue Jul 6, 2023 · 0 comments · Fixed by #598
Closed
2 of 3 tasks

Python 3.12: PyUnicode_AS_UNICODE has been removed #583

sanjayankur31 opened this issue Jul 6, 2023 · 0 comments · Fixed by #598
Labels
bug Unicode Issues related to Unicode <-> bytes conversion

Comments

@sanjayankur31
Copy link

Description:

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

Affected versions (if applicable)
  • master branch (specify commit)
  • Latest stable version from pypi
  • Other (specify source)
Steps to reproduce (if applicable)

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);
      |              ^

Expected/actual outcome

[...]

@penguinolog penguinolog added bug Unicode Issues related to Unicode <-> bytes conversion labels Jul 6, 2023
penguinolog pushed a commit to penguinolog/urwid that referenced this issue Aug 16, 2023
penguinolog added a commit that referenced this issue Aug 16, 2023
Related: #583

Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
@penguinolog penguinolog pinned this issue Aug 22, 2023
penguinolog pushed a commit to penguinolog/urwid that referenced this issue Sep 4, 2023
penguinolog added a commit that referenced this issue Sep 4, 2023
Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
penguinolog pushed a commit to penguinolog/urwid that referenced this issue Sep 4, 2023
Replace as pep-0393 recommended:

* `PyUnicode_AS_UNICODE` by `PyUnicode_ReadChar`
  (use Stable API)

* Enable PR tests on python 3.12
@penguinolog penguinolog linked a pull request Sep 4, 2023 that will close this issue
6 tasks
penguinolog added a commit that referenced this issue Sep 4, 2023
* Fix #583: python 3.12 compatibility

Replace as pep-0393 recommended:

* `PyUnicode_AS_UNICODE` by `PyUnicode_ReadChar`
  (use Stable API)

* Enable PR tests on python 3.12

* Force Limited API following pep-0384

---------

Co-authored-by: Aleksei Stepanov <alekseis@nvidia.com>
@penguinolog penguinolog unpinned this issue Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unicode Issues related to Unicode <-> bytes conversion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants