Skip to content

Can't run with python 3.13.0a1 #343

Description

@MrBitBucket

whoops on title I seem to have pre-empted Guido at time travel it is of course 3.13.0a1 I meant :)

I get this error when build latest git with python 3.13.0a1

(.py313) robin@host/devel
$ python -c'import cairo'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/robin/devel/.py313/lib/python3.13/site-packages/cairo/__init__.py", line 1, in <module>
    from ._cairo import *  # noqa: F401,F403
    ^^^^^^^^^^^^^^^^^^^^^
ImportError: /home/robin/devel/.py313/lib/python3.13/site-packages/cairo/_cairo.cpython-313-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_AsString

I can fix this using this patch

diff --git a/cairo/enums.c b/cairo/enums.c
index 37accd0..272c1c5 100644
--- a/cairo/enums.c
+++ b/cairo/enums.c
@@ -126,7 +126,7 @@ int_enum_get_name(PyObject *obj) {
         return NULL;
 
     return PyUnicode_FromFormat ("%s.%s", Py_TYPE(obj)->tp_name,
-                                 _PyUnicode_AsString(name_obj));
+                                 PyUnicode_AsUTF8(name_obj));
 }
 
 static PyObject *

although I don't know if there a better replacement for _PyUnicode_AsString

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions