Commit cf3ae02d authored by Kevin Modzelewski's avatar Kevin Modzelewski

some small refcounting fixes. need to refcount hclses as well now

parent 6d47b61a
......@@ -60,7 +60,7 @@ const char* Py_FileSystemDefaultEncoding = "UTF-8"; // Pyston change: modified t
extern "C" Box* trap() {
raise(SIGTRAP);
return None;
Py_RETURN_NONE;
}
/* Helper for PyObject_Dir.
......
......@@ -1182,6 +1182,13 @@ void Box::setattr(BoxedString* attr, Box* val, SetattrRewriteArgs* rewrite_args)
HCAttrs* attrs = getHCAttrsPtr();
HiddenClass* hcls = attrs->hcls;
if (unlikely(hcls == NULL)) {
// We could update PyObject_Init and PyObject_INIT to do this, but that has a small compatibility
// issue (what if people don't call either of those) and I'm not sure that this check will be that
// harmful. But if it is we might want to try pushing this assignment to allocation time.
hcls = attrs->hcls = root_hcls;
}
if (hcls->type == HiddenClass::DICT_BACKED) {
if (rewrite_args)
assert(!rewrite_args->out_success);
......
......@@ -3166,7 +3166,7 @@ extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) noexcept {
// but it's nice to initialize the hcls here so we don't have to check it on every getattr/setattr.
// TODO It does mean that anything not defering to this function will have to call
// initUserAttrs themselves, though.
initUserAttrs(op, tp);
//initUserAttrs(op, tp);
#ifndef NDEBUG
if (tp->tp_flags & Py_TPFLAGS_HEAPTYPE) {
......
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