blob: b162d84e5db41b93638ed2ef8d564ae7f9ebcc08 [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__,
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +03006"stack_effect($module, opcode, oparg=None, /, *, jump=None)\n"
Serhiy Storchaka1009bf12015-04-03 23:53:51 +03007"--\n"
8"\n"
9"Compute the stack effect of the opcode.");
10
11#define _OPCODE_STACK_EFFECT_METHODDEF \
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030012 {"stack_effect", (PyCFunction)_opcode_stack_effect, METH_FASTCALL|METH_KEYWORDS, _opcode_stack_effect__doc__},
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030013
14static int
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030015_opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg,
16 PyObject *jump);
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030017
18static PyObject *
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030019_opcode_stack_effect(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030020{
21 PyObject *return_value = NULL;
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030022 static const char * const _keywords[] = {"", "", "jump", NULL};
23 static _PyArg_Parser _parser = {"i|O$O:stack_effect", _keywords, 0};
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030024 int opcode;
25 PyObject *oparg = Py_None;
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030026 PyObject *jump = Py_None;
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030027 int _return_value;
28
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030029 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
30 &opcode, &oparg, &jump)) {
Victor Stinner259f0e42017-01-17 01:35:17 +010031 goto exit;
32 }
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030033 _return_value = _opcode_stack_effect_impl(module, opcode, oparg, jump);
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030034 if ((_return_value == -1) && PyErr_Occurred()) {
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030035 goto exit;
Serhiy Storchaka5dee6552016-06-09 16:16:06 +030036 }
Serhiy Storchaka1009bf12015-04-03 23:53:51 +030037 return_value = PyLong_FromLong((long)_return_value);
38
39exit:
40 return return_value;
41}
Serhiy Storchaka7bdf2822018-09-18 09:54:26 +030042/*[clinic end generated code: output=bbf6c4cfc91edc29 input=a9049054013a1b77]*/