Commit e17f1272 authored by Boxiang Sun's avatar Boxiang Sun

type_cls freeze should put behind all tp slots

parent dd0c2f1a
...@@ -4523,9 +4523,9 @@ void setupRuntime() { ...@@ -4523,9 +4523,9 @@ void setupRuntime() {
SET = typeFromClass(set_cls); SET = typeFromClass(set_cls);
FROZENSET = typeFromClass(frozenset_cls); FROZENSET = typeFromClass(frozenset_cls);
object_cls->giveAttr("__repr__", // object_cls->giveAttr("__repr__",
new BoxedFunction(BoxedCode::create((void*)object_repr, UNKNOWN, 1, false, false, // new BoxedFunction(BoxedCode::create((void*)object_repr, UNKNOWN, 1, false, false,
"object.__repr__", "", ParamNames::empty(), CAPI))); // "object.__repr__", "", ParamNames::empty(), CAPI)));
object_cls->giveAttr( object_cls->giveAttr(
"__subclasshook__", "__subclasshook__",
boxInstanceMethod(object_cls, autoDecref(new BoxedFunction(BoxedCode::create((void*)objectSubclasshook, UNKNOWN, boxInstanceMethod(object_cls, autoDecref(new BoxedFunction(BoxedCode::create((void*)objectSubclasshook, UNKNOWN,
...@@ -4556,7 +4556,7 @@ void setupRuntime() { ...@@ -4556,7 +4556,7 @@ void setupRuntime() {
type_cls->giveAttr( type_cls->giveAttr(
"__new__", new BoxedFunction(BoxedCode::create((void*)typeNewGeneric, UNKNOWN, 4, false, false, "type.__new__"), "__new__", new BoxedFunction(BoxedCode::create((void*)typeNewGeneric, UNKNOWN, 4, false, false, "type.__new__"),
{ NULL, NULL })); { NULL, NULL }));
type_cls->giveAttr("__repr__", new BoxedFunction(BoxedCode::create((void*)typeRepr, STR, 1, "type.__repr__"))); // type_cls->giveAttr("__repr__", new BoxedFunction(BoxedCode::create((void*)typeRepr, STR, 1, "type.__repr__")));
type_cls->tp_hash = (hashfunc)_Py_HashPointer; type_cls->tp_hash = (hashfunc)_Py_HashPointer;
type_cls->giveAttrDescriptor("__module__", type_module, type_set_module); type_cls->giveAttrDescriptor("__module__", type_module, type_set_module);
type_cls->giveAttrMember("__mro__", T_OBJECT, offsetof(BoxedClass, tp_mro)); type_cls->giveAttrMember("__mro__", T_OBJECT, offsetof(BoxedClass, tp_mro));
...@@ -4567,11 +4567,11 @@ void setupRuntime() { ...@@ -4567,11 +4567,11 @@ void setupRuntime() {
new BoxedFunction(BoxedCode::create((void*)typeSubclasses, UNKNOWN, 1, "type.__subclasses__"))); new BoxedFunction(BoxedCode::create((void*)typeSubclasses, UNKNOWN, 1, "type.__subclasses__")));
type_cls->giveAttr("mro", new BoxedFunction(BoxedCode::create((void*)typeMro, UNKNOWN, 1, "type.mro"))); type_cls->giveAttr("mro", new BoxedFunction(BoxedCode::create((void*)typeMro, UNKNOWN, 1, "type.mro")));
type_cls->tp_richcompare = type_richcompare; type_cls->tp_richcompare = type_richcompare;
add_operators(type_cls);
type_cls->freeze();
type_cls->tp_new = type_new; type_cls->tp_new = type_new;
type_cls->tp_repr = type_repr; type_cls->tp_repr = type_repr;
add_operators(type_cls);
type_cls->freeze();
type_cls->tpp_call.capi_val = &typeTppCall<CAPI>; type_cls->tpp_call.capi_val = &typeTppCall<CAPI>;
type_cls->tpp_call.cxx_val = &typeTppCall<CXX>; type_cls->tpp_call.cxx_val = &typeTppCall<CXX>;
...@@ -4602,6 +4602,7 @@ void setupRuntime() { ...@@ -4602,6 +4602,7 @@ void setupRuntime() {
object_cls->giveAttrDescriptor("__class__", object_get_class, object_set_class); object_cls->giveAttrDescriptor("__class__", object_get_class, object_set_class);
object_cls->tp_str = object_str; object_cls->tp_str = object_str;
// object_cls->tp_repr = object_str;
add_operators(object_cls); add_operators(object_cls);
object_cls->freeze(); object_cls->freeze();
......
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