Add pyext support for @tuple.__new__

pull/335/head
Ibrahim Numanagić 2023-03-30 10:39:08 -07:00
parent 3e1a9a8a35
commit 9ef321ca4a
1 changed files with 4 additions and 2 deletions

View File

@ -334,8 +334,10 @@ void Cache::populatePythonModule() {
std::string call = pyWrap + ".wrap_multiple";
bool isMagic = false;
if (startswith(n, "__") && endswith(n, "__")) {
if (auto i = in(classes[pyWrap].methods,
"wrap_magic_" + n.substr(2, n.size() - 4))) {
auto m = n.substr(2, n.size() - 4);
if (m == "new" && c.ast->hasAttr(Attr::Tuple))
m = "init";
if (auto i = in(classes[pyWrap].methods, "wrap_magic_" + m)) {
call = *i;
isMagic = true;
}