Commit e38aa0d5 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add some more checking -- don't want non-gc values to sneak in again

parent 918b0f00
...@@ -289,6 +289,9 @@ extern "C" void _PyErr_BadInternalCall(const char* filename, int lineno) { ...@@ -289,6 +289,9 @@ extern "C" void _PyErr_BadInternalCall(const char* filename, int lineno) {
} }
extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) { extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) {
assert(gc::isValidGCObject(op));
assert(gc::isValidGCObject(tp));
RELEASE_ASSERT(op, ""); RELEASE_ASSERT(op, "");
RELEASE_ASSERT(tp, ""); RELEASE_ASSERT(tp, "");
Py_TYPE(op) = tp; Py_TYPE(op) = tp;
...@@ -296,6 +299,9 @@ extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) { ...@@ -296,6 +299,9 @@ extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) {
} }
extern "C" PyVarObject* PyObject_InitVar(PyVarObject* op, PyTypeObject* tp, Py_ssize_t size) { extern "C" PyVarObject* PyObject_InitVar(PyVarObject* op, PyTypeObject* tp, Py_ssize_t size) {
assert(gc::isValidGCObject(op));
assert(gc::isValidGCObject(tp));
RELEASE_ASSERT(op, ""); RELEASE_ASSERT(op, "");
RELEASE_ASSERT(tp, ""); RELEASE_ASSERT(tp, "");
Py_TYPE(op) = tp; Py_TYPE(op) = tp;
......
...@@ -303,6 +303,8 @@ extern "C" Box* createUserClass(std::string* name, Box* _base, Box* _attr_dict) ...@@ -303,6 +303,8 @@ extern "C" Box* createUserClass(std::string* name, Box* _base, Box* _attr_dict)
ASSERT(_attr_dict->cls == dict_cls, "%s", getTypeName(_attr_dict)->c_str()); ASSERT(_attr_dict->cls == dict_cls, "%s", getTypeName(_attr_dict)->c_str());
BoxedDict* attr_dict = static_cast<BoxedDict*>(_attr_dict); BoxedDict* attr_dict = static_cast<BoxedDict*>(_attr_dict);
RELEASE_ASSERT(attr_dict->d.count(boxStrConstant("__metaclass__")) == 0, "metaclasses not supported yet");
BoxedClass* made; BoxedClass* made;
if (base->instancesHaveAttrs()) { if (base->instancesHaveAttrs()) {
......
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