]> granicus.if.org Git - python/commitdiff
Issue #13959: Move module type constants to Lib/imp.py.
authorBrett Cannon <brett@python.org>
Fri, 4 May 2012 20:13:30 +0000 (16:13 -0400)
committerBrett Cannon <brett@python.org>
Fri, 4 May 2012 20:13:30 +0000 (16:13 -0400)
Python/import.c
Python/importdl.h

index 4edc3a75f83ead7c6a4f394070663d1bc1f63475..4f8229bd0b1924d2f992b7717738cffd07d17bee 100644 (file)
@@ -2091,17 +2091,6 @@ static PyMethodDef imp_methods[] = {
     {NULL,                      NULL}           /* sentinel */
 };
 
-static int
-setint(PyObject *d, char *name, int value)
-{
-    PyObject *v;
-    int err;
-
-    v = PyLong_FromLong((long)value);
-    err = PyDict_SetItemString(d, name, v);
-    Py_XDECREF(v);
-    return err;
-}
 
 static struct PyModuleDef impmodule = {
     PyModuleDef_HEAD_INIT,
@@ -2127,17 +2116,6 @@ PyInit_imp(void)
     if (d == NULL)
         goto failure;
 
-    if (setint(d, "SEARCH_ERROR", SEARCH_ERROR) < 0) goto failure;
-    if (setint(d, "PY_SOURCE", PY_SOURCE) < 0) goto failure;
-    if (setint(d, "PY_COMPILED", PY_COMPILED) < 0) goto failure;
-    if (setint(d, "C_EXTENSION", C_EXTENSION) < 0) goto failure;
-    if (setint(d, "PY_RESOURCE", PY_RESOURCE) < 0) goto failure;
-    if (setint(d, "PKG_DIRECTORY", PKG_DIRECTORY) < 0) goto failure;
-    if (setint(d, "C_BUILTIN", C_BUILTIN) < 0) goto failure;
-    if (setint(d, "PY_FROZEN", PY_FROZEN) < 0) goto failure;
-    if (setint(d, "PY_CODERESOURCE", PY_CODERESOURCE) < 0) goto failure;
-    if (setint(d, "IMP_HOOK", IMP_HOOK) < 0) goto failure;
-
     return m;
   failure:
     Py_XDECREF(m);
index 32c6b5bb7f4b4f9fbe4ba81451c903e2519cce30..6b9cf750a451bcee91a527758dec38d73a497f61 100644 (file)
@@ -6,21 +6,6 @@ extern "C" {
 #endif
 
 
-/* Definitions for dynamic loading of extension modules */
-enum filetype {
-    SEARCH_ERROR,
-    PY_SOURCE,
-    PY_COMPILED,
-    C_EXTENSION,
-    PY_RESOURCE, /* Mac only */
-    PKG_DIRECTORY,
-    C_BUILTIN,
-    PY_FROZEN,
-    PY_CODERESOURCE, /* Mac only */
-    IMP_HOOK
-};
-
-
 extern const char *_PyImport_DynLoadFiletab[];
 
 extern PyObject *_PyImport_LoadDynamicModule(PyObject *name, PyObject *pathname,