Commit 3a8884ed authored by Kevin Modzelewski's avatar Kevin Modzelewski

Call tp_init in typeCall for extension classes

Actually, for now in all cases unless __init__ is a Python function.
parent 4008df8e
......@@ -1152,7 +1152,7 @@ static PyObject* slot_tp_del(PyObject* self) noexcept {
}
}
static int slot_tp_init(PyObject* self, PyObject* args, PyObject* kwds) noexcept {
/* Pyston change: static */ int slot_tp_init(PyObject* self, PyObject* args, PyObject* kwds) noexcept {
STAT_TIMER(t0, "us_timer_slot_tpinit", SLOT_AVOIDABILITY(self));
static PyObject* init_str;
......
......@@ -51,6 +51,7 @@ int slot_sq_contains(PyObject* self, PyObject* value) noexcept;
Py_ssize_t slot_sq_length(PyObject* self) noexcept;
PyObject* slot_tp_getattr_hook(PyObject* self, PyObject* name) noexcept;
PyObject* tp_new_wrapper(PyTypeObject* self, BoxedTuple* args, Box* kwds) noexcept;
int slot_tp_init(PyObject* self, PyObject* args, PyObject* kwds) noexcept;
class GetattrRewriteArgs;
Box* slotTpGetattrHookInternal(Box* self, BoxedString* attr, GetattrRewriteArgs* rewrite_args);
......
......@@ -75,9 +75,9 @@ static Box* propertyInit(Box* _self, Box* fget, Box* fset, Box** args) {
Box* doc = args[1];
BoxedProperty* self = static_cast<BoxedProperty*>(_self);
self->prop_get = fget;
self->prop_set = fset;
self->prop_del = fdel;
self->prop_get = fget == None ? NULL : fget;
self->prop_set = fset == None ? NULL : fset;
self->prop_del = fdel == None ? NULL : fdel;
self->prop_doc = doc;
self->getter_doc = false;
......@@ -151,6 +151,12 @@ static Box* property_copy(BoxedProperty* old, Box* get, Box* set, Box* del) {
return prop;
} else {
if (!get)
get = None;
if (!set)
set = None;
if (!del)
del = None;
Box* doc;
if ((old->getter_doc && get != None) || !old->prop_doc)
doc = None;
......
This diff is collapsed.
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