summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-06-02 14:10:45 (GMT)
committerGitHub <noreply@github.com>2023-06-02 14:10:45 (GMT)
commit44bb03f856c30f709bb983f9830eafe914a742aa (patch)
tree59221bf329af04954f5a7669a87c8c82a9add670 /Python/bytecodes.c
parent41de54378d54f7ffc38f07db4219e80f48c4249e (diff)
downloadcpython-44bb03f856c30f709bb983f9830eafe914a742aa.zip
cpython-44bb03f856c30f709bb983f9830eafe914a742aa.tar.gz
cpython-44bb03f856c30f709bb983f9830eafe914a742aa.tar.bz2
gh-105214: Use named constants for MAKE_FUNCTION oparg (#105215)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index e86b11f..9fcf69b 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -18,6 +18,7 @@
#include "pycore_object.h" // _PyObject_GC_TRACK()
#include "pycore_moduleobject.h" // PyModuleObject
#include "pycore_opcode.h" // EXTRA_CASES
+#include "pycore_opcode_utils.h" // MAKE_FUNCTION_*
#include "pycore_pyerrors.h" // _PyErr_GetRaisedException()
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_range.h" // _PyRangeIterObject
@@ -3245,10 +3246,10 @@ dummy_func(
CHECK_EVAL_BREAKER();
}
- inst(MAKE_FUNCTION, (defaults if (oparg & 0x01),
- kwdefaults if (oparg & 0x02),
- annotations if (oparg & 0x04),
- closure if (oparg & 0x08),
+ inst(MAKE_FUNCTION, (defaults if (oparg & MAKE_FUNCTION_DEFAULTS),
+ kwdefaults if (oparg & MAKE_FUNCTION_KWDEFAULTS),
+ annotations if (oparg & MAKE_FUNCTION_ANNOTATIONS),
+ closure if (oparg & MAKE_FUNCTION_CLOSURE),
codeobj -- func)) {
PyFunctionObject *func_obj = (PyFunctionObject *)
@@ -3259,19 +3260,19 @@ dummy_func(
goto error;
}
- if (oparg & 0x08) {
+ if (oparg & MAKE_FUNCTION_CLOSURE) {
assert(PyTuple_CheckExact(closure));
func_obj->func_closure = closure;
}
- if (oparg & 0x04) {
+ if (oparg & MAKE_FUNCTION_ANNOTATIONS) {
assert(PyTuple_CheckExact(annotations));
func_obj->func_annotations = annotations;
}
- if (oparg & 0x02) {
+ if (oparg & MAKE_FUNCTION_KWDEFAULTS) {
assert(PyDict_CheckExact(kwdefaults));
func_obj->func_kwdefaults = kwdefaults;
}
- if (oparg & 0x01) {
+ if (oparg & MAKE_FUNCTION_DEFAULTS) {
assert(PyTuple_CheckExact(defaults));
func_obj->func_defaults = defaults;
}