Remove some unnecessary casts in Python builtin code

This commit is contained in:
William S Fulton 2019-02-02 23:48:52 +00:00
commit 64a7678759

View file

@ -4029,9 +4029,7 @@ public:
String *doc = Getattr(mgetset, "doc"); String *doc = Getattr(mgetset, "doc");
if (!doc) if (!doc)
doc = NewStringf("%s.%s", name, memname); doc = NewStringf("%s.%s", name, memname);
String *entry = String *entry = NewStringf("{ (char *)\"%s\", %s, %s, (char *)\"%s\", &%s }", memname, getter_closure, setter_closure, doc, gspair);
NewStringf("{ (char *)\"%s\", (getter)%s, (setter)%s, (char *)\"%s\", (void *)&%s }\n", memname, getter_closure,
setter_closure, doc, gspair);
if (GetFlag(mgetset, "static")) { if (GetFlag(mgetset, "static")) {
Printf(f, "static PyGetSetDef %s_def = %s;\n", gspair, entry); Printf(f, "static PyGetSetDef %s_def = %s;\n", gspair, entry);
Printf(f_init, "static_getset = SwigPyStaticVar_new_getset(metatype, &%s_def);\n", gspair); Printf(f_init, "static_getset = SwigPyStaticVar_new_getset(metatype, &%s_def);\n", gspair);
@ -4043,7 +4041,7 @@ public:
Delete(gspair); Delete(gspair);
Delete(entry); Delete(entry);
} }
Printv(f, getset_def, " {NULL, NULL, NULL, NULL, NULL} /* Sentinel */\n", "};\n\n", NIL); Printv(f, getset_def, " { NULL, NULL, NULL, NULL, NULL } /* Sentinel */\n", "};\n\n", NIL);
// Rich compare function // Rich compare function
Hash *richcompare = Getattr(n, "python:richcompare"); Hash *richcompare = Getattr(n, "python:richcompare");