Add PyFunction::keywords field

pull/335/head
A. R. Shajii 2023-03-04 16:46:38 -05:00
parent 7f82194c06
commit 691c1b8fec
2 changed files with 15 additions and 10 deletions

View File

@ -756,6 +756,9 @@ void LLVMVisitor::writeToPythonExtension(const PyModule &pymod,
std::vector<llvm::Constant *> pyMethods;
for (auto &pyfunc : functions) {
int flag = 0;
if (pyfunc.keywords) {
flag = PYEXT_METH_FASTCALL | PYEXT_METH_KEYWORDS;
} else {
switch (pyfunc.nargs) {
case 0:
flag = PYEXT_METH_NOARGS;
@ -767,6 +770,7 @@ void LLVMVisitor::writeToPythonExtension(const PyModule &pymod,
flag = PYEXT_METH_FASTCALL;
break;
}
}
switch (pyfunc.type) {
case PyFunction::CLASS:

View File

@ -18,6 +18,7 @@ struct PyFunction {
Func *func = nullptr;
Type type = Type::TOPLEVEL;
int nargs = 0;
bool keywords = false;
bool coexist = false;
};