Commit 0be24aec authored by Marius Wachtler's avatar Marius Wachtler

code type: do not use GC (same as cpython)

parent e432e29c
......@@ -100,18 +100,9 @@ Box* BoxedCode::flags(Box* b, void*) noexcept {
return boxInt(flags);
}
int BoxedCode::traverse(Box* self, visitproc visit, void* arg) noexcept {
BoxedCode* o = static_cast<BoxedCode*>(self);
Py_VISIT(o->_filename);
Py_VISIT(o->_name);
return 0;
}
void BoxedCode::dealloc(Box* b) noexcept {
BoxedCode* o = static_cast<BoxedCode*>(b);
PyObject_GC_UnTrack(o);
Py_XDECREF(o->_filename);
Py_XDECREF(o->_name);
......@@ -210,9 +201,8 @@ extern "C" int PyCode_HasFreeVars(PyCodeObject* _code) noexcept {
}
void setupCode() {
code_cls
= BoxedClass::create(type_cls, object_cls, 0, 0, sizeof(BoxedCode), false, "code", false,
(destructor)BoxedCode::dealloc, NULL, true, (traverseproc)BoxedCode::traverse, NOCLEAR);
code_cls = BoxedClass::create(type_cls, object_cls, 0, 0, sizeof(BoxedCode), false, "code", false,
(destructor)BoxedCode::dealloc, NULL, false, (traverseproc)NULL, NOCLEAR);
code_cls->giveAttrBorrowed("__new__", Py_None); // Hacky way of preventing users from instantiating this
......
......@@ -35,7 +35,7 @@ public:
Py_XINCREF(name);
}
DEFAULT_CLASS(code_cls);
DEFAULT_CLASS_SIMPLE(code_cls, false);
// These need to be static functions rather than methods because function
// pointers could point to them.
......@@ -48,7 +48,6 @@ public:
static Box* varnames(Box* b, void*) noexcept;
static Box* flags(Box* b, void*) noexcept;
static int traverse(Box* self, visitproc visit, void* arg) noexcept;
static void dealloc(Box* b) noexcept;
};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment