Package: src:python-atom
Version: 0.12.1-2
User: [email protected]
Usertags: python3.15
Tags: patch, ftbfs, forky, sid
Severity: important
Hi!
While rebuilding the python related packages against the Python 3.15rc2
version we found that python-atom fails to build from source [1].
The error is:
error: ‘PyWeakref_GET_OBJECT’ was not declared in this scope
This is because the use of deprecated PyWeakref_GET_OBJECT needs to be
replaced with GetRef. I have created add patch to use PyWeakref_GetRef.
This should be forwarded upstream.
I've applied the fix in the sandbox [2] to verify that it builds
successfully, please consider applying the patch to support the upcoming
3.15 version.
Setting the severity to important for now. Once Python 3.15 is released,
it will be added to python3-defaults and this bug will become release
critical.
Happy hacking,
[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4597822/
[2]: https://debusine.debian.net/debian/r-python-python3.15/
--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
Description: Use PyWeakref_GetRef on Python 3.13+
PyWeakref_GET_OBJECT was removed in Python 3.15.
Author: Maximiliano Curia <[email protected]>
Forwarded: no
Index: python-atom/atom/src/methodwrapper.cpp
===================================================================
--- python-atom.orig/atom/src/methodwrapper.cpp
+++ python-atom/atom/src/methodwrapper.cpp
@@ -36,6 +36,19 @@ MethodWrapper_dealloc( MethodWrapper* se
PyObject*
MethodWrapper__call__( MethodWrapper* self, PyObject* args, PyObject* kwargs )
{
+#if PY_VERSION_HEX >= 0x030D0000
+ PyObject* raw_im_self = 0;
+ if( PyWeakref_GetRef( self->im_selfref, &raw_im_self ) < 0 )
+ return 0;
+ cppy::ptr im_self( raw_im_self );
+ if( im_self )
+ {
+ cppy::ptr method( PyMethod_New( self->im_func, im_self.get() ) );
+ if( !method )
+ return 0;
+ return PyObject_Call( method.get(), args, kwargs );
+ }
+#else
PyObject* im_self = PyWeakref_GET_OBJECT( self->im_selfref );
if( im_self != Py_None )
{
@@ -44,6 +57,7 @@ MethodWrapper__call__( MethodWrapper* se
return 0;
return PyObject_Call( method.get(), args, kwargs );
}
+#endif
Py_RETURN_NONE;
}
@@ -55,10 +69,23 @@ MethodWrapper_richcompare( MethodWrapper
{
if( PyMethod_Check( other ) && PyMethod_GET_SELF( other ) )
{
+#if PY_VERSION_HEX >= 0x030D0000
+ if( self->im_func == PyMethod_GET_FUNCTION( other ) )
+ {
+ PyObject* raw_im_self = 0;
+ if( PyWeakref_GetRef( self->im_selfref, &raw_im_self ) < 0 )
+ return 0;
+ cppy::ptr im_self( raw_im_self );
+ if( im_self.get() == PyMethod_GET_SELF( other ) )
+ Py_RETURN_TRUE;
+ }
+ Py_RETURN_FALSE;
+#else
if( ( self->im_func == PyMethod_GET_FUNCTION( other ) ) &&
( PyWeakref_GET_OBJECT( self->im_selfref ) == PyMethod_GET_SELF( other ) ) )
Py_RETURN_TRUE;
Py_RETURN_FALSE;
+#endif
}
else if( MethodWrapper::TypeCheck( other ) )
{
@@ -78,9 +105,17 @@ MethodWrapper_richcompare( MethodWrapper
int
MethodWrapper__bool__( MethodWrapper* self )
{
+#if PY_VERSION_HEX >= 0x030D0000
+ PyObject* raw_im_self = 0;
+ if( PyWeakref_GetRef( self->im_selfref, &raw_im_self ) < 0 )
+ return -1;
+ Py_XDECREF( raw_im_self );
+ return raw_im_self != 0;
+#else
if( PyWeakref_GET_OBJECT( self->im_selfref ) != Py_None )
return 1;
return 0;
+#endif
}