From 3046647478f584b665a33c3a1c3d1d6117979d64 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 22 Feb 2011 23:16:19 +0000 Subject: Issue #3080: Remove unused argument of _PyImport_GetDynLoadFunc() The first argument, fqname, was not used. --- Python/dynload_shlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/dynload_shlib.c') diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 7ea510e862..1c215c329c 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -75,7 +75,7 @@ static struct { static int nhandles = 0; -dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, +dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname, const char *pathname, FILE *fp) { dl_funcptr p; -- cgit v1.2.1 From 84a9491874cb99e24227206345f5a4b6060e27c8 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 20 Feb 2012 19:41:11 +0100 Subject: Issue #14040: Remove rarely used file name suffixes for C extensions (under POSIX mainly). This will improve import performance a bit (especially under importlib). --- Python/dynload_shlib.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'Python/dynload_shlib.c') diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 1c215c329c..ab24238f57 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -39,7 +39,6 @@ const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef __CYGWIN__ {".dll", "rb", C_EXTENSION}, - {"module.dll", "rb", C_EXTENSION}, #else /* !__CYGWIN__ */ #if defined(PYOS_OS2) && defined(PYCC_GCC) {".pyd", "rb", C_EXTENSION}, @@ -48,15 +47,10 @@ const struct filedescr _PyImport_DynLoadFiletab[] = { #ifdef __VMS {".exe", "rb", C_EXTENSION}, {".EXE", "rb", C_EXTENSION}, - {"module.exe", "rb", C_EXTENSION}, - {"MODULE.EXE", "rb", C_EXTENSION}, #else /* !__VMS */ {"." SOABI ".so", "rb", C_EXTENSION}, - {"module." SOABI ".so", "rb", C_EXTENSION}, {".abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION}, - {"module.abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION}, {".so", "rb", C_EXTENSION}, - {"module.so", "rb", C_EXTENSION}, #endif /* __VMS */ #endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */ #endif /* __CYGWIN__ */ -- cgit v1.2.1 From e6ecc6d13e7b3c963d6cabfdacca8138f968e970 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 14 Apr 2012 14:10:13 -0400 Subject: Issue #2377: Make importlib the implementation of __import__(). importlib._bootstrap is now frozen into Python/importlib.h and stored as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen code along with sys and imp and then uses _frozen_importlib._install() to set builtins.__import__() w/ _frozen_importlib.__import__(). --- Python/dynload_shlib.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'Python/dynload_shlib.c') diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index ab24238f57..94c6494ee2 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -115,10 +115,6 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname, dlopenflags = PyThreadState_GET()->interp->dlopenflags; #endif - if (Py_VerboseFlag) - PySys_WriteStderr("dlopen(\"%s\", %x);\n", pathname, - dlopenflags); - #ifdef __VMS /* VMS currently don't allow a pathname, use a logical name instead */ /* Concatenate 'python_module_' and shortname */ -- cgit v1.2.1 From 7fba2a9968a7b5c426dad6a2b02b95da914853ca Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 20 Apr 2012 15:22:50 -0400 Subject: Issue #14599: Generalize a test for ImportError.path and add support in Python/dynload_shlibs.c. This should fix the remaining importlib test failure on Windows. Support in AIX and HP-UX will be in a separate checkin. --- Python/dynload_shlib.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Python/dynload_shlib.c') diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 94c6494ee2..565facaf71 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -129,10 +129,19 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname, handle = dlopen(pathname, dlopenflags); if (handle == NULL) { + PyObject *mod_name = NULL; + PyObject *path = NULL; + PyObject *error_ob = NULL; const char *error = dlerror(); if (error == NULL) error = "unknown dlopen() error"; - PyErr_SetString(PyExc_ImportError, error); + error_ob = PyUnicode_FromString(error); + path = PyUnicode_FromString(pathname); + mod_name = PyUnicode_FromString(shortname); + PyErr_SetImportError(error_ob, mod_name, path); + Py_DECREF(error_ob); + Py_DECREF(path); + Py_DECREF(mod_name); return NULL; } if (fp != NULL && nhandles < 128) -- cgit v1.2.1 From f9e12fdf7205afea929ddb2b8f6e950721c831bf Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 4 May 2012 15:20:40 -0400 Subject: Issue #13959: Re-implement imp.get_suffixes() in Lib/imp.py. This introduces a new function, imp.extension_suffixes(), which is currently undocumented. That is forthcoming once issue #14657 is resolved and how to expose file suffixes is decided. --- Python/dynload_shlib.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Python/dynload_shlib.c') diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 565facaf71..24e4edebeb 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -36,25 +36,25 @@ live in the same directory. E.g. foomodule.cpython-32.so */ -const struct filedescr _PyImport_DynLoadFiletab[] = { +const char *_PyImport_DynLoadFiletab[] = { #ifdef __CYGWIN__ - {".dll", "rb", C_EXTENSION}, + ".dll", #else /* !__CYGWIN__ */ #if defined(PYOS_OS2) && defined(PYCC_GCC) - {".pyd", "rb", C_EXTENSION}, - {".dll", "rb", C_EXTENSION}, + ".pyd", + ".dll", #else /* !(defined(PYOS_OS2) && defined(PYCC_GCC)) */ #ifdef __VMS - {".exe", "rb", C_EXTENSION}, - {".EXE", "rb", C_EXTENSION}, + ".exe", + ".EXE", #else /* !__VMS */ - {"." SOABI ".so", "rb", C_EXTENSION}, - {".abi" PYTHON_ABI_STRING ".so", "rb", C_EXTENSION}, - {".so", "rb", C_EXTENSION}, + "." SOABI ".so", + ".abi" PYTHON_ABI_STRING ".so", + ".so", #endif /* __VMS */ #endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */ #endif /* __CYGWIN__ */ - {0, 0} + NULL, }; static struct { -- cgit v1.2.1 From d5942516ea776a0993c6cdfcb1fe553e286d1557 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 22 Aug 2012 17:45:52 +0200 Subject: Issue #15766: Fix a crash in imp.load_dynamic() on PyUnicode_FromString() failure --- Python/dynload_shlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Python/dynload_shlib.c') diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 24e4edebeb..0ca65c7877 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -139,9 +139,9 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname, path = PyUnicode_FromString(pathname); mod_name = PyUnicode_FromString(shortname); PyErr_SetImportError(error_ob, mod_name, path); - Py_DECREF(error_ob); - Py_DECREF(path); - Py_DECREF(mod_name); + Py_XDECREF(error_ob); + Py_XDECREF(path); + Py_XDECREF(mod_name); return NULL; } if (fp != NULL && nhandles < 128) -- cgit v1.2.1