blob: 2de8bd77d6a2654d8e48838d746d6a8f637713e6 [file] [log] [blame]
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(_opcode_stack_effect__doc__,
6"stack_effect($module, opcode, oparg=None, /)\n"
7"--\n"
8"\n"
9"Compute the stack effect of the opcode.");
10
11#define _OPCODE_STACK_EFFECT_METHODDEF \
Victor Stinner259f0e42017-01-17 01:35:17 +010012 {"stack_effect", (PyCFunction)_opcode_stack_effect, METH_FASTCALL, _opcode_stack_effect__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030013
14static int
Serhiy Storchaka1a2b24f2016-07-07 17:35:15 +030015_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030016
17static PyObject *
Serhiy Storchaka6969eaf2017-07-03 21:20:15 +030018_opcode_stack_effect(PyObject *module, PyObject **args, Py_ssize_t nargs)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030019{
20 PyObject *return_value = NULL;
21 int opcode;
22 PyObject *oparg = Py_None;
23 int _return_value;
24
Sylvain74453812017-06-10 06:51:48 +020025 if (!_PyArg_ParseStack(args, nargs, "i|O:stack_effect",
26 &opcode, &oparg)) {
Victor Stinner259f0e42017-01-17 01:35:17 +010027 goto exit;
28 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030029 _return_value = _opcode_stack_effect_impl(module, opcode, oparg);
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030030 if ((_return_value == -1) && PyErr_Occurred()) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030031 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030032 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030033 return_value = PyLong_FromLong((long)_return_value);
34
35exit:
36 return return_value;
37}
Serhiy Storchaka6969eaf2017-07-03 21:20:15 +030038/*[clinic end generated code: output=616105b05b55eb45 input=a9049054013a1b77]*/