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 { ...@@ -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)); STAT_TIMER(t0, "us_timer_slot_tpinit", SLOT_AVOIDABILITY(self));
static PyObject* init_str; static PyObject* init_str;
......
...@@ -51,6 +51,7 @@ int slot_sq_contains(PyObject* self, PyObject* value) noexcept; ...@@ -51,6 +51,7 @@ int slot_sq_contains(PyObject* self, PyObject* value) noexcept;
Py_ssize_t slot_sq_length(PyObject* self) noexcept; Py_ssize_t slot_sq_length(PyObject* self) noexcept;
PyObject* slot_tp_getattr_hook(PyObject* self, PyObject* name) noexcept; PyObject* slot_tp_getattr_hook(PyObject* self, PyObject* name) noexcept;
PyObject* tp_new_wrapper(PyTypeObject* self, BoxedTuple* args, Box* kwds) 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; class GetattrRewriteArgs;
Box* slotTpGetattrHookInternal(Box* self, BoxedString* attr, GetattrRewriteArgs* rewrite_args); Box* slotTpGetattrHookInternal(Box* self, BoxedString* attr, GetattrRewriteArgs* rewrite_args);
......
...@@ -75,9 +75,9 @@ static Box* propertyInit(Box* _self, Box* fget, Box* fset, Box** args) { ...@@ -75,9 +75,9 @@ static Box* propertyInit(Box* _self, Box* fget, Box* fset, Box** args) {
Box* doc = args[1]; Box* doc = args[1];
BoxedProperty* self = static_cast<BoxedProperty*>(_self); BoxedProperty* self = static_cast<BoxedProperty*>(_self);
self->prop_get = fget; self->prop_get = fget == None ? NULL : fget;
self->prop_set = fset; self->prop_set = fset == None ? NULL : fset;
self->prop_del = fdel; self->prop_del = fdel == None ? NULL : fdel;
self->prop_doc = doc; self->prop_doc = doc;
self->getter_doc = false; self->getter_doc = false;
...@@ -151,6 +151,12 @@ static Box* property_copy(BoxedProperty* old, Box* get, Box* set, Box* del) { ...@@ -151,6 +151,12 @@ static Box* property_copy(BoxedProperty* old, Box* get, Box* set, Box* del) {
return prop; return prop;
} else { } else {
if (!get)
get = None;
if (!set)
set = None;
if (!del)
del = None;
Box* doc; Box* doc;
if ((old->getter_doc && get != None) || !old->prop_doc) if ((old->getter_doc && get != None) || !old->prop_doc)
doc = None; 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