mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Back out trying to use the C values for CO_xxx.
__future__.py reverted to 1.9. newmodule.c reverted to 2.32.
This commit is contained in:
parent
4e2fbce71c
commit
89675078cb
2 changed files with 12 additions and 41 deletions
|
@ -220,38 +220,9 @@ char new_doc[] =
|
|||
\n\
|
||||
You need to know a great deal about the interpreter to use this!";
|
||||
|
||||
static void
|
||||
insertint(PyObject *d, char *name, int value)
|
||||
{
|
||||
PyObject *v = PyInt_FromLong((long) value);
|
||||
if (v == NULL) {
|
||||
/* Don't bother reporting this error */
|
||||
PyErr_Clear();
|
||||
}
|
||||
else {
|
||||
PyDict_SetItemString(d, name, v);
|
||||
Py_DECREF(v);
|
||||
}
|
||||
}
|
||||
|
||||
DL_EXPORT(void)
|
||||
initnew(void)
|
||||
{
|
||||
PyObject *m;
|
||||
PyObject *d;
|
||||
|
||||
m = Py_InitModule4("new", new_methods, new_doc, (PyObject *)NULL,
|
||||
PYTHON_API_VERSION);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
#define ADDSYM(TOKEN) insertint(d, #TOKEN, TOKEN)
|
||||
ADDSYM(CO_OPTIMIZED);
|
||||
ADDSYM(CO_NEWLOCALS);
|
||||
ADDSYM(CO_VARARGS);
|
||||
ADDSYM(CO_VARKEYWORDS);
|
||||
ADDSYM(CO_NESTED);
|
||||
ADDSYM(CO_GENERATOR);
|
||||
ADDSYM(CO_GENERATOR_ALLOWED);
|
||||
ADDSYM(CO_FUTURE_DIVISION);
|
||||
#undef ADDSYM
|
||||
Py_InitModule4("new", new_methods, new_doc, (PyObject *)NULL,
|
||||
PYTHON_API_VERSION);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue