Skip to content

Commit

Permalink
Rename atomref to ref to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
frmdstryr committed Jan 18, 2025
1 parent 2793fa8 commit b25084f
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions enaml/src/subscription_observer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static cppy::ptr atomref;
struct SubscriptionObserver
{
PyObject_HEAD
PyObject* atomref;
PyObject* ref;
PyObject* name;

static PyType_Spec TypeObject_Spec;
Expand Down Expand Up @@ -63,8 +63,8 @@ SubscriptionObserver_new( PyTypeObject* type, PyObject* args, PyObject* kwargs )
}
SubscriptionObserver* self = reinterpret_cast<SubscriptionObserver*>( ptr.get() );

self->atomref = PyObject_CallOneArg(atomref.get(), owner);
if( !self->atomref )
self->ref = PyObject_CallOneArg(atomref.get(), owner);
if( !self->ref )
{
return 0;
}
Expand All @@ -76,15 +76,15 @@ SubscriptionObserver_new( PyTypeObject* type, PyObject* args, PyObject* kwargs )
void
SubscriptionObserver_clear( SubscriptionObserver* self )
{
Py_CLEAR( self->atomref );
Py_CLEAR( self->ref );
Py_CLEAR( self->name );
}


int
SubscriptionObserver_traverse( SubscriptionObserver* self, visitproc visit, void* arg )
{
Py_VISIT( self->atomref );
Py_VISIT( self->ref );
return 0;
}

Expand All @@ -101,7 +101,7 @@ SubscriptionObserver_dealloc( SubscriptionObserver* self )
int
SubscriptionObserver__bool__( SubscriptionObserver* self )
{
return PyObject_IsTrue( self->atomref );
return PyObject_IsTrue( self->ref );
}


Expand All @@ -117,9 +117,9 @@ PyObject*
SubscriptionObserver_call( SubscriptionObserver* self, PyObject* args, PyObject* kwargs )
{

if( PyObject_IsTrue( self->atomref ) )
if( PyObject_IsTrue( self->ref ) )
{
cppy::ptr owner( PyObject_CallNoArgs( self->atomref ) );
cppy::ptr owner( PyObject_CallNoArgs( self->ref ) );
if ( !owner )
return 0;
cppy::ptr engine( owner.getattr("_d_engine") );
Expand Down Expand Up @@ -156,7 +156,7 @@ PyDoc_STRVAR(SubscriptionObserver__doc__,
PyObject*
SubscriptionObserver_get_ref( SubscriptionObserver* self, void* context )
{
return cppy::incref( self->atomref );
return cppy::incref( self->ref );
}


Expand All @@ -165,7 +165,7 @@ SubscriptionObserver_set_ref( SubscriptionObserver* self, PyObject* value, void*
{
if( value != Py_None )
return cppy::type_error("ref can only be set to None");
cppy::replace( &self->atomref, Py_None );
cppy::replace( &self->ref, Py_None );
return 0;
}

Expand Down

0 comments on commit b25084f

Please sign in to comment.