File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
graalpython/com.oracle.graal.python.test/src/tests/cpyext Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,31 @@ def test_int(self):
109
109
tester = TestInt ()
110
110
assert int (tester ) == 42
111
111
112
+ def test_inherit_slots_with_managed_class (self ):
113
+ TestTpAllocWithManaged = CPyExtType ("TestTpAllocWithManaged" ,
114
+ """
115
+ static PyObject *test_alloc(PyTypeObject *type, Py_ssize_t nitems) {
116
+ PyErr_SetString(PyExc_RuntimeError, "Should not call this tp_alloc");
117
+ return NULL;
118
+ }
119
+ """ ,
120
+ tp_alloc = "test_alloc"
121
+ )
122
+ TestTpAllocCall = CPyExtType ("TestTpAllocCall" ,
123
+ '''
124
+ static PyObject* testslots_tp_alloc(PyObject* self, PyObject *cls) {
125
+ return ((PyTypeObject *)cls)->tp_alloc((PyTypeObject *) cls, 0);
126
+ }
127
+ ''' ,
128
+ tp_methods = '{"createObj", (PyCFunction)testslots_tp_alloc, METH_O, ""}'
129
+ )
130
+ class managed (TestTpAllocWithManaged ):
131
+ pass
132
+ t = TestTpAllocCall ()
133
+
134
+ assert t .createObj (managed ) != None
135
+
136
+
112
137
def test_float_binops (self ):
113
138
TestFloatBinop = CPyExtType ("TestFloatBinop" ,
114
139
"""
You can’t perform that action at this time.
0 commit comments