Commit 92c78799 authored by Kevin Modzelewski's avatar Kevin Modzelewski

fix the build issues

parent e78dc8d7
......@@ -8,8 +8,8 @@ extern "C" {
// Pyston addition: refcounting annotations:
#define BORROWED(T) T
#define STOLEN(T) T
#define BORROWED(...) __VA_ARGS__
#define STOLEN(...) __VA_ARGS__
#define NOREFCHECK ;
/* Object and type object interface */
......
......@@ -469,6 +469,21 @@ int BoxedMethodDescriptor::traverse(Box* _self, visitproc visit, void *arg) noex
return 0;
}
void BoxedWrapperDescriptor::dealloc(Box* _self) noexcept {
BoxedWrapperDescriptor* self = static_cast<BoxedWrapperDescriptor*>(_self);
PyObject_GC_UnTrack(self);
Py_XDECREF(self->type);
self->cls->tp_free(self);
}
int BoxedWrapperDescriptor::traverse(Box* _self, visitproc visit, void *arg) noexcept {
BoxedWrapperDescriptor* self = static_cast<BoxedWrapperDescriptor*>(_self);
Py_VISIT(self->type);
return 0;
}
void BoxedWrapperObject::dealloc(Box* _self) noexcept {
BoxedWrapperObject* self = static_cast<BoxedWrapperObject*>(_self);
......
......@@ -457,14 +457,16 @@ static int dict_ass_sub(PyDictObject* mp, PyObject* v, PyObject* w) noexcept {
extern "C" int PyDict_DelItem(PyObject* op, PyObject* key) noexcept {
if (PyDict_Check(op)) {
BoxedDict* self = static_cast<BoxedDict*>(op);
assert(0 && "untested");
decltype(self->d)::iterator it;
try {
auto it = self->d.find(k);
it = self->d.find(key);
} catch (ExcInfo e) {
setCAPIException(e);
return -1;
}
if (it == self->d.end())
if (it == self->d.end()) {
PyErr_SetObject(KeyError, autoDecref(BoxedTuple::create1(key)));
return -1;
}
......
......@@ -302,6 +302,11 @@ void caughtCxxException(ExcInfo* exc_info) {
struct ExcState {
bool is_reraise;
constexpr ExcState() : is_reraise(false) {}
} static __thread exc_state;
bool exceptionAtLineCheck() {
if (exc_state.is_reraise) {
exc_state.is_reraise = false;
......
......@@ -143,7 +143,7 @@ extern "C" Box* deopt(AST_expr* expr, Box* value) {
}
extern "C" void printHelper(Box* w, Box* v, bool nl) {
assert(0 && "is this tested?");`
assert(0 && "is this tested?");
// copied from cpythons PRINT_ITEM and PRINT_NEWLINE op handling code
if (w == NULL || w == None) {
w = PySys_GetObject("stdout");
......@@ -2878,7 +2878,7 @@ extern "C" void setattr(Box* obj, BoxedString* attr, STOLEN(Box*) attr_val) {
return;
}
AUTO_DECREF(val);
AUTO_DECREF(attr_val);
if (rewriter.get()) {
assert(setattr);
......@@ -5312,8 +5312,9 @@ Box* compareInternal(Box* lhs, Box* rhs, int op_type, CompareRewriteArgs* rewrit
bool negate = (op_type == AST_TYPE::NotIn);
if (rewrite_args) {
RewriterVar* r_contained_box = rewrite_args->rewriter->call(true, (void*)nonzeroAndBox<negate>, r_contained,
r_negate)->setType(RefType::OWNED);
RewriterVar* r_contained_box
= rewrite_args->rewriter->call(true, (void*)(negate ? nonzeroAndBox<true> : nonzeroAndBox<false>),
r_contained)->setType(RefType::OWNED);
rewrite_args->out_rtn = r_contained_box;
rewrite_args->out_success = true;
}
......@@ -5430,7 +5431,7 @@ Box* compareInternal(Box* lhs, Box* rhs, int op_type, CompareRewriteArgs* rewrit
}
return lrtn;
} else {
Py_DECREF(ltn);
Py_DECREF(lrtn);
rewrite_args = NULL;
}
}
......@@ -6921,8 +6922,8 @@ extern "C" void boxedLocalsDel(Box* boxedLocals, BoxedString* attr) {
assert(attr->data()[attr->size()] == '\0');
assertNameDefined(0, attr->data(), NameError, false /* local_var_msg */);
}
Box* key = it.first.value;
Box* value = it.second;
Box* key = it->first.value;
Box* value = it->second;
d.erase(it);
Py_DECREF(key);
Py_DECREF(value);
......
......@@ -48,7 +48,7 @@ public:
static void dealloc(BoxedSetIterator* o) noexcept {
PyObject_GC_UnTrack(o);
PyObject_ClearWeakRefs((PyObject*)self);
PyObject_ClearWeakRefs((PyObject*)o);
Py_DECREF(o->s);
......
......@@ -40,6 +40,7 @@
#include "runtime/dict.h"
#include "runtime/hiddenclass.h"
#include "runtime/ics.h"
#include "runtime/inline/list.h"
#include "runtime/iterobject.h"
#include "runtime/list.h"
#include "runtime/long.h"
......@@ -2398,7 +2399,7 @@ public:
HCAttrs* attrs = self->b->getHCAttrsPtr();
RELEASE_ASSERT(attrs->hcls->type == HiddenClass::NORMAL || attrs->hcls->type == HiddenClass::SINGLETON, "");
for (const auto& p : attrs->hcls->getStrAttrOffsets()) {
listAppend(rtn, p.first);
listAppendInternal(rtn, p.first);
}
return rtn;
}
......@@ -2412,7 +2413,7 @@ public:
HCAttrs* attrs = self->b->getHCAttrsPtr();
RELEASE_ASSERT(attrs->hcls->type == HiddenClass::NORMAL || attrs->hcls->type == HiddenClass::SINGLETON, "");
for (const auto& p : attrs->hcls->getStrAttrOffsets()) {
listAppend(rtn, attrs->attr_list->attrs[p.second]);
listAppendInternal(rtn, attrs->attr_list->attrs[p.second]);
}
return rtn;
}
......@@ -2427,7 +2428,7 @@ public:
RELEASE_ASSERT(attrs->hcls->type == HiddenClass::NORMAL || attrs->hcls->type == HiddenClass::SINGLETON, "");
for (const auto& p : attrs->hcls->getStrAttrOffsets()) {
BoxedTuple* t = BoxedTuple::create({ p.first, attrs->attr_list->attrs[p.second] });
listAppendStolen(rtn, t);
listAppendInternalStolen(rtn, t);
}
return rtn;
}
......@@ -2469,7 +2470,6 @@ public:
HCAttrs* attrs = self->b->getHCAttrsPtr();
RELEASE_ASSERT(attrs->hcls->type == HiddenClass::NORMAL || attrs->hcls->type == HiddenClass::SINGLETON, "");
attrs->clear();
AOEU
// Add the existing attrwrapper object (ie self) back as the attrwrapper:
self->b->appendNewHCAttr(self, NULL);
......@@ -3529,7 +3529,7 @@ void BoxedModule::dealloc(Box* b) noexcept {
int BoxedModule::traverse(Box* _m, visitproc visit, void* arg) noexcept {
BoxedModule* m = static_cast<BoxedModule*>(_m);
Py_VISIT_HCATTRS(m->attrs);
assert(!self->keep_alive.size());
assert(!m->keep_alive.size());
return 0;
}
......@@ -3964,8 +3964,9 @@ void setupRuntime() {
wrapperobject_cls = new (0)
BoxedClass(object_cls, 0, 0, sizeof(BoxedWrapperObject), false, "method-wrapper", false,
BoxedWrapperObject::dealloc, NULL, true, BoxedWrapperObject::traverse, NOCLEAR);
wrapperdescr_cls = new (0) BoxedClass(object_cls, 0, 0, sizeof(BoxedWrapperDescriptor), false, "wrapper_descriptor",
false, BoxedWrapperDescriptor::dealloc, NULL, false);
wrapperdescr_cls = new (0)
BoxedClass(object_cls, 0, 0, sizeof(BoxedWrapperDescriptor), false, "wrapper_descriptor", false,
BoxedWrapperDescriptor::dealloc, NULL, true, BoxedWrapperDescriptor::traverse, NOCLEAR);
EmptyString = new (0) BoxedString("");
constants.push_back(EmptyString);
......
......@@ -1200,7 +1200,8 @@ public:
Py_INCREF(type);
}
void dealloc(Box* b) noexcept;
static void dealloc(Box* b) noexcept;
static int traverse(Box* _self, visitproc visit, void *arg) noexcept;
DEFAULT_CLASS(wrapperdescr_cls);
......
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