Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0429e1a

Browse files
committed
Issue #13959: Move module type constants to Lib/imp.py.
1 parent 2d3ce9d commit 0429e1a

2 files changed

Lines changed: 0 additions & 37 deletions

File tree

Python/import.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,17 +2091,6 @@ static PyMethodDef imp_methods[] = {
20912091
{NULL, NULL} /* sentinel */
20922092
};
20932093

2094-
static int
2095-
setint(PyObject *d, char *name, int value)
2096-
{
2097-
PyObject *v;
2098-
int err;
2099-
2100-
v = PyLong_FromLong((long)value);
2101-
err = PyDict_SetItemString(d, name, v);
2102-
Py_XDECREF(v);
2103-
return err;
2104-
}
21052094

21062095
static struct PyModuleDef impmodule = {
21072096
PyModuleDef_HEAD_INIT,
@@ -2127,17 +2116,6 @@ PyInit_imp(void)
21272116
if (d == NULL)
21282117
goto failure;
21292118

2130-
if (setint(d, "SEARCH_ERROR", SEARCH_ERROR) < 0) goto failure;
2131-
if (setint(d, "PY_SOURCE", PY_SOURCE) < 0) goto failure;
2132-
if (setint(d, "PY_COMPILED", PY_COMPILED) < 0) goto failure;
2133-
if (setint(d, "C_EXTENSION", C_EXTENSION) < 0) goto failure;
2134-
if (setint(d, "PY_RESOURCE", PY_RESOURCE) < 0) goto failure;
2135-
if (setint(d, "PKG_DIRECTORY", PKG_DIRECTORY) < 0) goto failure;
2136-
if (setint(d, "C_BUILTIN", C_BUILTIN) < 0) goto failure;
2137-
if (setint(d, "PY_FROZEN", PY_FROZEN) < 0) goto failure;
2138-
if (setint(d, "PY_CODERESOURCE", PY_CODERESOURCE) < 0) goto failure;
2139-
if (setint(d, "IMP_HOOK", IMP_HOOK) < 0) goto failure;
2140-
21412119
return m;
21422120
failure:
21432121
Py_XDECREF(m);

Python/importdl.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,6 @@ extern "C" {
66
#endif
77

88

9-
/* Definitions for dynamic loading of extension modules */
10-
enum filetype {
11-
SEARCH_ERROR,
12-
PY_SOURCE,
13-
PY_COMPILED,
14-
C_EXTENSION,
15-
PY_RESOURCE, /* Mac only */
16-
PKG_DIRECTORY,
17-
C_BUILTIN,
18-
PY_FROZEN,
19-
PY_CODERESOURCE, /* Mac only */
20-
IMP_HOOK
21-
};
22-
23-
249
extern const char *_PyImport_DynLoadFiletab[];
2510

2611
extern PyObject *_PyImport_LoadDynamicModule(PyObject *name, PyObject *pathname,

0 commit comments

Comments
 (0)