Skip to content

Commit 6d69780

Browse files
committed
Rename MyObject to TryIncref
1 parent ac639f6 commit 6d69780

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_pythoncapi_compat_cext.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,17 +2449,17 @@ test_tuple(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
24492449
}
24502450

24512451
// Test adapted from CPython's _testcapi/object.c
2452-
static int MyObject_dealloc_called = 0;
2452+
static int TryIncref_dealloc_called = 0;
24532453

24542454
static void
2455-
MyObject_dealloc(PyObject *op)
2455+
TryIncref_dealloc(PyObject *op)
24562456
{
24572457
// PyUnstable_TryIncRef should return 0 if object is being deallocated
24582458
assert(Py_REFCNT(op) == 0);
24592459
assert(!PyUnstable_TryIncRef(op));
24602460
assert(Py_REFCNT(op) == 0);
24612461

2462-
MyObject_dealloc_called++;
2462+
TryIncref_dealloc_called++;
24632463
Py_TYPE(op)->tp_free(op);
24642464
}
24652465

@@ -2468,7 +2468,7 @@ static PyTypeObject TryIncrefType;
24682468
static PyObject*
24692469
test_try_incref(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
24702470
{
2471-
MyObject_dealloc_called = 0;
2471+
TryIncref_dealloc_called = 0;
24722472

24732473
PyObject *obj = PyObject_New(PyObject, &TryIncrefType);
24742474
if (obj == _Py_NULL) {
@@ -2484,7 +2484,7 @@ test_try_incref(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
24842484
Py_DECREF(obj);
24852485
Py_DECREF(obj);
24862486

2487-
assert(MyObject_dealloc_called == 1);
2487+
assert(TryIncref_dealloc_called == 1);
24882488
Py_RETURN_NONE;
24892489
}
24902490

@@ -2575,7 +2575,7 @@ module_exec(PyObject *module)
25752575
#endif
25762576
TryIncrefType.tp_name = "TryIncrefType";
25772577
TryIncrefType.tp_basicsize = sizeof(PyObject);
2578-
TryIncrefType.tp_dealloc = MyObject_dealloc;
2578+
TryIncrefType.tp_dealloc = TryIncref_dealloc;
25792579
TryIncrefType.tp_free = PyObject_Del;
25802580
if (PyType_Ready(&TryIncrefType) < 0) {
25812581
return -1;

0 commit comments

Comments
 (0)