Skip to content

Commit 7b6e71f

Browse files
committed
refactor(jsTypeFactory): evaluate function object flags once
1 parent 5a820f1 commit 7b6e71f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/jsTypeFactory.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,11 @@ bool callPyFunc(JSContext *cx, unsigned int argc, JS::Value *vp) {
331331
bool unknownNargs = false;
332332

333333
if (PyCFunction_Check(pyFunc)) {
334-
if (((PyCFunctionObject *)pyFunc)->m_ml->ml_flags & METH_NOARGS) { // 0 arguments
334+
const int funcFlags = ((PyCFunctionObject *)pyFunc)->m_ml->ml_flags;
335+
if (funcFlags & METH_NOARGS) { // 0 arguments
335336
nNormalArgs = 0;
336337
}
337-
else if (((PyCFunctionObject *)pyFunc)->m_ml->ml_flags & METH_O) { // 1 argument
338+
else if (funcFlags & METH_O) { // 1 argument
338339
nNormalArgs = 1;
339340
}
340341
else { // unknown number of arguments

0 commit comments

Comments
 (0)