diff options
author | Mohamed Koubaa <koubaa.m@gmail.com> | 2020-09-07 08:48:44 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-07 08:48:44 (GMT) |
commit | 426f2b4f13f392875e7861dbd7f34735731eff17 (patch) | |
tree | a636f78571058233fba15202f721b51f810c70c7 /Modules/_opcode.c | |
parent | 1aaa21ff818b08af2a68862b552b7ba0857492eb (diff) | |
download | cpython-426f2b4f13f392875e7861dbd7f34735731eff17.zip cpython-426f2b4f13f392875e7861dbd7f34735731eff17.tar.gz cpython-426f2b4f13f392875e7861dbd7f34735731eff17.tar.bz2 |
bpo-1635741: Port _opcode module to multi-phase init (PEP 489) (GH-22050)
Diffstat (limited to 'Modules/_opcode.c')
-rw-r--r-- | Modules/_opcode.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/Modules/_opcode.c b/Modules/_opcode.c index 42a8732..d8de076 100644 --- a/Modules/_opcode.c +++ b/Modules/_opcode.c @@ -36,8 +36,9 @@ _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg, return -1; } oparg_int = (int)PyLong_AsLong(oparg); - if ((oparg_int == -1) && PyErr_Occurred()) + if ((oparg_int == -1) && PyErr_Occurred()) { return -1; + } } else if (oparg != Py_None) { PyErr_SetString(PyExc_ValueError, @@ -67,30 +68,22 @@ _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg, return effect; } - - - static PyMethodDef opcode_functions[] = { _OPCODE_STACK_EFFECT_METHODDEF {NULL, NULL, 0, NULL} }; - static struct PyModuleDef opcodemodule = { PyModuleDef_HEAD_INIT, - "_opcode", - "Opcode support module.", - -1, - opcode_functions, - NULL, - NULL, - NULL, - NULL + .m_name = "_opcode", + .m_doc = "Opcode support module.", + .m_size = 0, + .m_methods = opcode_functions }; PyMODINIT_FUNC PyInit__opcode(void) { - return PyModule_Create(&opcodemodule); + return PyModuleDef_Init(&opcodemodule); } |