any_type_tests_needed = 0
# Use the simpler calling signature for zero- and one-argument functions.
if not self.entry.is_special and not self.star_arg and not self.starstar_arg:
- if self.entry.signature is TypeSlots.pyfunction_signature:
+ if self.entry.signature is TypeSlots.pyfunction_signature and Options.optimize_simple_methods:
if len(self.args) == 0:
self.entry.signature = TypeSlots.pyfunction_noargs
elif len(self.args) == 1:
# checking for NULL on every use, and can decref rather than xdecref at the end.
# WARNING: This is a work in progress, may currently segfault.
init_local_none = 1
+
+# Optimize no argument and one argument methods by using the METH_O and METH_NOARGS
+# calling conventions. These are faster calling conventions, but disallow the use of
+# keywords (which, admittedly, are of little use in these cases).
+optimize_simple_methods = 1