FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-1635741: port opcode module to multi-phase init (PEP 489) by koubaa · Pull Request #22050 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Port the :mod:`_opcode` extension module to multi-phase initialization
(:pep:`489`).
21 changes: 7 additions & 14 deletions Modules/_opcode.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}

Back | FazBrowse Home | New Git URL