[Python-checkins] cpython: Issue #13959: Move module type constants to Lib/imp.py.

brett.cannon python-checkins at python.org
Fri May 4 22:13:35 CEST 2012


http://hg.python.org/cpython/rev/22b0689346f9
changeset:   76760:22b0689346f9
user:        Brett Cannon <brett at python.org>
date:        Fri May 04 16:13:30 2012 -0400
summary:
  Issue #13959: Move module type constants to Lib/imp.py.

files:
  Python/import.c   |  22 ----------------------
  Python/importdl.h |  15 ---------------
  2 files changed, 0 insertions(+), 37 deletions(-)


diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -2091,17 +2091,6 @@
     {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 @@
     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);
diff --git a/Python/importdl.h b/Python/importdl.h
--- a/Python/importdl.h
+++ b/Python/importdl.h
@@ -6,21 +6,6 @@
 #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,

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list