~cjwatson/storm/py3-mocker-inspect

« back to all changes in this revision

Viewing changes to storm/cextensions.c

Rename double-underscore identifiers in C extensions. [r=simpoir]

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
typedef struct {
66
66
    PyObject_HEAD
67
 
    PyObject *__weakreflist;
 
67
    PyObject *_weakreflist;
68
68
    PyObject *_owner_ref;
69
69
    PyObject *_hooks;
70
70
} EventSystemObject;
84
84
 
85
85
typedef struct {
86
86
    PyObject_HEAD
87
 
    PyObject *__weakreflist;
 
87
    PyObject *_weakreflist;
88
88
    PyObject *_local_dispatch_table;
89
89
    PyObject *_local_precedence;
90
90
    PyObject *_local_reserved_words;
97
97
 
98
98
typedef struct {
99
99
    PyDictObject super;
100
 
    PyObject *__weakreflist;
101
 
    PyObject *__obj_ref;
102
 
    PyObject *__obj_ref_callback;
 
100
    PyObject *_weakreflist;
 
101
    PyObject *_obj_ref;
 
102
    PyObject *_obj_ref_callback;
103
103
    PyObject *cls_info;
104
104
    PyObject *event;
105
105
    PyObject *variables;
220
220
    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &owner))
221
221
        return -1;
222
222
 
223
 
    self->__weakreflist = NULL;
 
223
    self->_weakreflist = NULL;
224
224
 
225
225
    /* self._owner_ref = weakref.ref(owner) */
226
226
    self->_owner_ref = PyWeakref_NewRef(owner, NULL);
246
246
static int
247
247
EventSystem_clear(EventSystemObject *self)
248
248
{
249
 
    if (self->__weakreflist)
 
249
    if (self->_weakreflist)
250
250
        PyObject_ClearWeakRefs((PyObject *)self);
251
251
    Py_CLEAR(self->_owner_ref);
252
252
    Py_CLEAR(self->_hooks);
503
503
    (traverseproc)EventSystem_traverse,  /*tp_traverse*/
504
504
    (inquiry)EventSystem_clear,          /*tp_clear*/
505
505
    0,                      /*tp_richcompare*/
506
 
    offsetof(EventSystemObject, __weakreflist), /*tp_weaklistoffset*/
 
506
    offsetof(EventSystemObject, _weakreflist), /*tp_weaklistoffset*/
507
507
    0,                      /*tp_iter*/
508
508
    0,                      /*tp_iternext*/
509
509
    EventSystem_methods,        /*tp_methods*/
1213
1213
static int
1214
1214
Compile_clear(CompileObject *self)
1215
1215
{
1216
 
    if (self->__weakreflist)
 
1216
    if (self->_weakreflist)
1217
1217
        PyObject_ClearWeakRefs((PyObject *)self);
1218
1218
    Py_CLEAR(self->_local_dispatch_table);
1219
1219
    Py_CLEAR(self->_local_precedence);
1768
1768
    (traverseproc)Compile_traverse,  /*tp_traverse*/
1769
1769
    (inquiry)Compile_clear,          /*tp_clear*/
1770
1770
    0,                      /*tp_richcompare*/
1771
 
    offsetof(CompileObject, __weakreflist), /*tp_weaklistoffset*/
 
1771
    offsetof(CompileObject, _weakreflist), /*tp_weaklistoffset*/
1772
1772
    0,                      /*tp_iter*/
1773
1773
    0,                      /*tp_iternext*/
1774
1774
    Compile_methods,        /*tp_methods*/
1824
1824
                                                              NULL));
1825
1825
 
1826
1826
    /* self.set_obj(obj) */
1827
 
    CATCH(NULL, self->__obj_ref_callback =
 
1827
    CATCH(NULL, self->_obj_ref_callback =
1828
1828
                    PyCFunction_NewEx(&ObjectInfo_deleted_callback,
1829
1829
                                      (PyObject *)self, NULL));
1830
1830
 
1831
1831
    CATCH(NULL,
1832
 
          self->__obj_ref = PyWeakref_NewRef(obj, self->__obj_ref_callback));
 
1832
          self->_obj_ref = PyWeakref_NewRef(obj, self->_obj_ref_callback));
1833
1833
 
1834
1834
    /* self.event = event = EventSystem(self) */
1835
1835
    CATCH(NULL,
1903
1903
static PyObject *
1904
1904
ObjectInfo_get_obj(ObjectInfoObject *self, PyObject *args)
1905
1905
{
1906
 
    PyObject *obj = PyWeakref_GET_OBJECT(self->__obj_ref);
 
1906
    PyObject *obj = PyWeakref_GET_OBJECT(self->_obj_ref);
1907
1907
    Py_INCREF(obj);
1908
1908
    return obj;
1909
1909
}
1917
1917
    if (!PyArg_ParseTuple(args, "O", &obj))
1918
1918
        return NULL;
1919
1919
 
1920
 
    Py_DECREF(self->__obj_ref);
1921
 
    self->__obj_ref = PyWeakref_NewRef(obj, self->__obj_ref_callback);
1922
 
    if (!self->__obj_ref)
 
1920
    Py_DECREF(self->_obj_ref);
 
1921
    self->_obj_ref = PyWeakref_NewRef(obj, self->_obj_ref_callback);
 
1922
    if (!self->_obj_ref)
1923
1923
        return NULL;
1924
1924
 
1925
1925
    Py_RETURN_NONE;
1953
1953
static int
1954
1954
ObjectInfo_traverse(ObjectInfoObject *self, visitproc visit, void *arg)
1955
1955
{
1956
 
    Py_VISIT(self->__obj_ref);
1957
 
    Py_VISIT(self->__obj_ref_callback);
 
1956
    Py_VISIT(self->_obj_ref);
 
1957
    Py_VISIT(self->_obj_ref_callback);
1958
1958
    Py_VISIT(self->cls_info);
1959
1959
    Py_VISIT(self->event);
1960
1960
    Py_VISIT(self->variables);
1965
1965
static int
1966
1966
ObjectInfo_clear(ObjectInfoObject *self)
1967
1967
{
1968
 
    Py_CLEAR(self->__obj_ref);
1969
 
    Py_CLEAR(self->__obj_ref_callback);
 
1968
    Py_CLEAR(self->_obj_ref);
 
1969
    Py_CLEAR(self->_obj_ref_callback);
1970
1970
    Py_CLEAR(self->cls_info);
1971
1971
    Py_CLEAR(self->event);
1972
1972
    Py_CLEAR(self->variables);
1997
1997
static void
1998
1998
ObjectInfo_dealloc(ObjectInfoObject *self)
1999
1999
{
2000
 
    if (self->__weakreflist)
 
2000
    if (self->_weakreflist)
2001
2001
        PyObject_ClearWeakRefs((PyObject *)self);
2002
 
    Py_CLEAR(self->__obj_ref);
2003
 
    Py_CLEAR(self->__obj_ref_callback);
 
2002
    Py_CLEAR(self->_obj_ref);
 
2003
    Py_CLEAR(self->_obj_ref_callback);
2004
2004
    Py_CLEAR(self->cls_info);
2005
2005
    Py_CLEAR(self->event);
2006
2006
    Py_CLEAR(self->variables);
2058
2058
    (traverseproc)ObjectInfo_traverse, /*tp_traverse*/
2059
2059
    (inquiry)ObjectInfo_clear, /*tp_clear*/
2060
2060
    ObjectInfo_richcompare, /*tp_richcompare*/
2061
 
    offsetof(ObjectInfoObject, __weakreflist), /*tp_weaklistoffset*/
 
2061
    offsetof(ObjectInfoObject, _weakreflist), /*tp_weaklistoffset*/
2062
2062
    0,                      /*tp_iter*/
2063
2063
    0,                      /*tp_iternext*/
2064
2064
    ObjectInfo_methods,     /*tp_methods*/