1/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(_opcode_stack_effect__doc__,
6"stack_effect($module, opcode, oparg=None, /, *, jump=None)\n"
7"--\n"
8"\n"
9"Compute the stack effect of the opcode.");
10
11#define _OPCODE_STACK_EFFECT_METHODDEF \
12 {"stack_effect", (PyCFunction)(void(*)(void))_opcode_stack_effect, METH_FASTCALL|METH_KEYWORDS, _opcode_stack_effect__doc__},
13
14static int
15_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg,
16 PyObject *jump);
17
18static PyObject *
19_opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
20{
21 PyObject *return_value = NULL;
22 static const char * const _keywords[] = {"", "", "jump", NULL};
23 static _PyArg_Parser _parser = {NULL, _keywords, "stack_effect", 0};
24 PyObject *argsbuf[3];
25 Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
26 int opcode;
27 PyObject *oparg = Py_None;
28 PyObject *jump = Py_None;
29 int _return_value;
30
31 args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
32 if (!args) {
33 goto exit;
34 }
35 opcode = _PyLong_AsInt(args[0]);
36 if (opcode == -1 && PyErr_Occurred()) {
37 goto exit;
38 }
39 if (nargs < 2) {
40 goto skip_optional_posonly;
41 }
42 noptargs--;
43 oparg = args[1];
44skip_optional_posonly:
45 if (!noptargs) {
46 goto skip_optional_kwonly;
47 }
48 jump = args[2];
49skip_optional_kwonly:
50 _return_value = _opcode_stack_effect_impl(module, opcode, oparg, jump);
51 if ((_return_value == -1) && PyErr_Occurred()) {
52 goto exit;
53 }
54 return_value = PyLong_FromLong((long)_return_value);
55
56exit:
57 return return_value;
58}
59/*[clinic end generated code: output=bcf66d25c2624197 input=a9049054013a1b77]*/
60