summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2023-06-17 16:00:16 (GMT)
committerGitHub <noreply@github.com>2023-06-17 16:00:16 (GMT)
commit14d01262dad02579b3dffe5965f640ce21c38896 (patch)
treed3e4dc72599c95f5dc3b3dd7eec5a1f4f3d673b0 /Modules
parent34e93d3998bab8acd651c50724eb1977f4860a08 (diff)
downloadcpython-14d01262dad02579b3dffe5965f640ce21c38896.zip
cpython-14d01262dad02579b3dffe5965f640ce21c38896.tar.gz
cpython-14d01262dad02579b3dffe5965f640ce21c38896.tar.bz2
gh-105481: remove HAS_ARG, HAS_CONST, IS_JUMP_OPCODE, IS_PSEUDO_OPCODE and replace by their new versions (#105865)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_opcode.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/Modules/_opcode.c b/Modules/_opcode.c
index b70d426..3c0fce4 100644
--- a/Modules/_opcode.c
+++ b/Modules/_opcode.c
@@ -27,25 +27,16 @@ _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg,
PyObject *jump)
/*[clinic end generated code: output=64a18f2ead954dbb input=461c9d4a44851898]*/
{
- int effect;
int oparg_int = 0;
int jump_int;
- if (HAS_ARG(opcode)) {
- if (oparg == Py_None) {
- PyErr_SetString(PyExc_ValueError,
- "stack_effect: opcode requires oparg but oparg was not specified");
- return -1;
- }
+
+ if (oparg != Py_None) {
oparg_int = (int)PyLong_AsLong(oparg);
if ((oparg_int == -1) && PyErr_Occurred()) {
return -1;
}
}
- else if (oparg != Py_None) {
- PyErr_SetString(PyExc_ValueError,
- "stack_effect: opcode does not permit oparg but oparg was specified");
- return -1;
- }
+
if (jump == Py_None) {
jump_int = -1;
}
@@ -60,11 +51,10 @@ _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg,
"stack_effect: jump must be False, True or None");
return -1;
}
- effect = PyCompile_OpcodeStackEffectWithJump(opcode, oparg_int, jump_int);
+ int effect = PyCompile_OpcodeStackEffectWithJump(opcode, oparg_int, jump_int);
if (effect == PY_INVALID_STACK_EFFECT) {
- PyErr_SetString(PyExc_ValueError,
- "invalid opcode or oparg");
- return -1;
+ PyErr_SetString(PyExc_ValueError, "invalid opcode or oparg");
+ return -1;
}
return effect;
}