ยปCore Development>Code coverage>Python/dynload_hpux.c

Python code coverage for Python/dynload_hpux.c

#countcontent
1n/a
2n/a/* Support for dynamic loading of extension modules */
3n/a
4n/a#include "dl.h"
5n/a#include <errno.h>
6n/a
7n/a#include "Python.h"
8n/a#include "importdl.h"
9n/a
10n/a#if defined(__hp9000s300)
11n/a#define FUNCNAME_PATTERN "_%.20s_%.200s"
12n/a#else
13n/a#define FUNCNAME_PATTERN "%.20s_%.200s"
14n/a#endif
15n/a
16n/aconst char *_PyImport_DynLoadFiletab[] = {SHLIB_EXT, NULL};
17n/a
18n/adl_funcptr _PyImport_FindSharedFuncptr(const char *prefix,
19n/a const char *shortname,
20n/a const char *pathname, FILE *fp)
21n/a{
22n/a dl_funcptr p;
23n/a shl_t lib;
24n/a int flags;
25n/a char funcname[258];
26n/a
27n/a flags = BIND_FIRST | BIND_DEFERRED;
28n/a if (Py_VerboseFlag) {
29n/a flags = BIND_FIRST | BIND_IMMEDIATE |
30n/a BIND_NONFATAL | BIND_VERBOSE;
31n/a printf("shl_load %s\n",pathname);
32n/a }
33n/a lib = shl_load(pathname, flags, 0);
34n/a /* XXX Chuck Blake once wrote that 0 should be BIND_NOSTART? */
35n/a if (lib == NULL) {
36n/a char buf[256];
37n/a PyObject *pathname_ob = NULL;
38n/a PyObject *buf_ob = NULL;
39n/a PyObject *shortname_ob = NULL;
40n/a
41n/a if (Py_VerboseFlag)
42n/a perror(pathname);
43n/a PyOS_snprintf(buf, sizeof(buf), "Failed to load %.200s",
44n/a pathname);
45n/a buf_ob = PyUnicode_FromString(buf);
46n/a shortname_ob = PyUnicode_FromString(shortname);
47n/a pathname_ob = PyUnicode_FromString(pathname);
48n/a PyErr_SetImportError(buf_ob, shortname_ob, pathname_ob);
49n/a Py_DECREF(buf_ob);
50n/a Py_DECREF(shortname_ob);
51n/a Py_DECREF(pathname_ob);
52n/a return NULL;
53n/a }
54n/a PyOS_snprintf(funcname, sizeof(funcname), FUNCNAME_PATTERN,
55n/a prefix, shortname);
56n/a if (Py_VerboseFlag)
57n/a printf("shl_findsym %s\n", funcname);
58n/a if (shl_findsym(&lib, funcname, TYPE_UNDEFINED, (void *) &p) == -1) {
59n/a shl_unload(lib);
60n/a p = NULL;
61n/a }
62n/a if (p == NULL && Py_VerboseFlag)
63n/a perror(funcname);
64n/a
65n/a return p;
66n/a}