From 9ef321ca4aad373e80ef4c6964ca581fa14fc9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ibrahim=20Numanagic=CC=81?= Date: Thu, 30 Mar 2023 10:39:08 -0700 Subject: [PATCH] Add pyext support for @tuple.__new__ --- codon/parser/cache.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/codon/parser/cache.cpp b/codon/parser/cache.cpp index 7e608b32..c6ea0035 100644 --- a/codon/parser/cache.cpp +++ b/codon/parser/cache.cpp @@ -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; }