Mercurial > cpython-lru_cache-weakref
annotate Python/importdl.c @ 84172:e353f64dfd95
importlib.abc.SourceLoader.get_source() was re-raising SyntaxError and
UnicodeDecodeError as ImportError. That was over-reaching the point of
raising ImportError in get_source() (which is to signal the source
code was not found when it should have). Conflating the two exceptions
with ImportError could lead to masking errors with the source which
should be known outside of whether there was an error simply getting
the source to begin with.
| author | Brett Cannon <brett@python.org> |
|---|---|
| date | Sun, 16 Jun 2013 18:05:54 -0400 |
| parents | 573010778eed |
| children | 4343dfaca8e2 |
| rev | line source |
|---|---|
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 /* Support for dynamic loading of extension modules */ |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
5314
diff
changeset
|
4 #include "Python.h" |
|
11618
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
5 |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
6 /* ./configure sets HAVE_DYNAMIC_LOADING if dynamic loading of modules is |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
7 supported on this platform. configure will then compile and link in one |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
8 of the dynload_*.c files, as appropriate. We will call a function in |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
9 those modules to get a function pointer to the module's init function. |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
10 */ |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
11 #ifdef HAVE_DYNAMIC_LOADING |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
12 |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 #include "importdl.h" |
|
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 |
|
69145
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
15 #ifdef MS_WINDOWS |
|
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
16 extern dl_funcptr _PyImport_GetDynLoadWindows(const char *shortname, |
|
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
17 PyObject *pathname, FILE *fp); |
|
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
18 #else |
|
68108
0874698b1201
Issue #3080: Remove unused argument of _PyImport_GetDynLoadFunc()
Victor Stinner <victor.stinner@haypocalc.com>
parents:
65418
diff
changeset
|
19 extern dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname, |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
20 const char *pathname, FILE *fp); |
|
69145
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
21 #endif |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 |
|
5373
5880384d7c71
Quickly renamed the remaining files -- this directory is done.
Guido van Rossum <guido@python.org>
parents:
5314
diff
changeset
|
23 PyObject * |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
24 _PyImport_LoadDynamicModule(PyObject *name, PyObject *path, FILE *fp) |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 { |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
26 PyObject *m = NULL; |
|
69145
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
27 #ifndef MS_WINDOWS |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
28 PyObject *pathbytes; |
|
69145
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
29 #endif |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
30 PyObject *nameascii; |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
31 char *namestr, *lastdot, *shortname, *packagecontext, *oldcontext; |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
32 dl_funcptr p0; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
33 PyObject* (*p)(void); |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
34 struct PyModuleDef *def; |
|
11600
14561e8395bb
Moved most of the platform-specific code to dynload_<platform>.c files.
Guido van Rossum <guido@python.org>
parents:
11469
diff
changeset
|
35 |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
36 m = _PyImport_FindExtensionObject(name, path); |
|
68712
2425717c6430
Issue #3080: Import builtins using Unicode strings
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68108
diff
changeset
|
37 if (m != NULL) { |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
38 Py_INCREF(m); |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
39 return m; |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
40 } |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
41 |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
42 /* name must be encodable to ASCII because dynamic module must have a |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
43 function called "PyInit_NAME", they are written in C, and the C language |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
44 doesn't accept non-ASCII identifiers. */ |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
45 nameascii = PyUnicode_AsEncodedString(name, "ascii", NULL); |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
46 if (nameascii == NULL) |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
47 return NULL; |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
48 |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
49 namestr = PyBytes_AS_STRING(nameascii); |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
50 if (namestr == NULL) |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
51 goto error; |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
52 |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
53 lastdot = strrchr(namestr, '.'); |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
54 if (lastdot == NULL) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
55 packagecontext = NULL; |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
56 shortname = namestr; |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
57 } |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
58 else { |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
59 packagecontext = namestr; |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
60 shortname = lastdot+1; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
61 } |
|
3907
ac1d5abfd78e
Changes for AIX sharedlibs.
Guido van Rossum <guido@python.org>
parents:
3898
diff
changeset
|
62 |
|
69145
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
63 #ifdef MS_WINDOWS |
|
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
64 p0 = _PyImport_GetDynLoadWindows(shortname, path, fp); |
|
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
65 #else |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
66 pathbytes = PyUnicode_EncodeFSDefault(path); |
|
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
67 if (pathbytes == NULL) |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
68 goto error; |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
69 p0 = _PyImport_GetDynLoadFunc(shortname, |
|
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
70 PyBytes_AS_STRING(pathbytes), fp); |
|
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
71 Py_DECREF(pathbytes); |
|
69145
1b7f484bab6e
Issue #11619: _PyImport_LoadDynamicModule() doesn't encode the path to bytes
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68716
diff
changeset
|
72 #endif |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
73 p = (PyObject*(*)(void))p0; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
74 if (PyErr_Occurred()) |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
75 goto error; |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
76 if (p == NULL) { |
|
76434
573010778eed
Issue #14599: Generalize a test for ImportError.path and add support
Brett Cannon <brett@python.org>
parents:
76303
diff
changeset
|
77 PyObject *msg = PyUnicode_FromFormat("dynamic module does not define " |
|
573010778eed
Issue #14599: Generalize a test for ImportError.path and add support
Brett Cannon <brett@python.org>
parents:
76303
diff
changeset
|
78 "init function (PyInit_%s)", |
|
573010778eed
Issue #14599: Generalize a test for ImportError.path and add support
Brett Cannon <brett@python.org>
parents:
76303
diff
changeset
|
79 shortname); |
|
573010778eed
Issue #14599: Generalize a test for ImportError.path and add support
Brett Cannon <brett@python.org>
parents:
76303
diff
changeset
|
80 PyErr_SetImportError(msg, name, path); |
|
573010778eed
Issue #14599: Generalize a test for ImportError.path and add support
Brett Cannon <brett@python.org>
parents:
76303
diff
changeset
|
81 Py_DECREF(msg); |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
82 goto error; |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
83 } |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
84 oldcontext = _Py_PackageContext; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
85 _Py_PackageContext = packagecontext; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
86 m = (*p)(); |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
87 _Py_PackageContext = oldcontext; |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
88 if (m == NULL) |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
89 goto error; |
|
2052
d7e91437f0a2
Lots of changes, most minor (fatal() instead of abort(), use of
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
91 if (PyErr_Occurred()) { |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
92 PyErr_Format(PyExc_SystemError, |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
93 "initialization of %s raised unreported exception", |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
94 shortname); |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
95 goto error; |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
96 } |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
43573
diff
changeset
|
97 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
98 /* Remember pointer to module init function. */ |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
99 def = PyModule_GetDef(m); |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
100 def->m_base.m_init = p; |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
43573
diff
changeset
|
101 |
|
61466
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
102 /* Remember the filename as the __file__ attribute */ |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
103 if (PyModule_AddObject(m, "__file__", path) < 0) |
|
cab14be0ada1
Recorded merge of revisions 81029 via svnmerge from
Antoine Pitrou <solipsis@pitrou.net>
parents:
47580
diff
changeset
|
104 PyErr_Clear(); /* Not important enough to report */ |
|
65418
fd5135cbd928
_PyImport_FixupExtension() and _PyImport_FindExtension() uses FS encoding
Victor Stinner <victor.stinner@haypocalc.com>
parents:
61466
diff
changeset
|
105 else |
|
fd5135cbd928
_PyImport_FixupExtension() and _PyImport_FindExtension() uses FS encoding
Victor Stinner <victor.stinner@haypocalc.com>
parents:
61466
diff
changeset
|
106 Py_INCREF(path); |
|
30316
19611d101d23
Patch #794826: Add __file__ in dynamically loaded modules for multiple
Martin v. Löwis <martin@v.loewis.de>
parents:
25040
diff
changeset
|
107 |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
108 if (_PyImport_FixupExtensionObject(m, name, path) < 0) |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
109 goto error; |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
110 Py_DECREF(nameascii); |
|
68716
ef2b6305d395
Issue #3080: _PyImport_LoadDynamicModule() uses Unicode for name and path
Victor Stinner <victor.stinner@haypocalc.com>
parents:
68712
diff
changeset
|
111 return m; |
|
69889
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
112 |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
113 error: |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
114 Py_DECREF(nameascii); |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
115 Py_XDECREF(m); |
|
eb003c3d1770
_PyImport_LoadDynamicModule() encodes the module name explicitly to ASCII
Victor Stinner <victor.stinner@haypocalc.com>
parents:
69145
diff
changeset
|
116 return NULL; |
|
11618
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
117 } |
|
528559a0b2f2
Cleanup patches from Greg Stein:
Guido van Rossum <guido@python.org>
parents:
11600
diff
changeset
|
118 |
|
11600
14561e8395bb
Moved most of the platform-specific code to dynload_<platform>.c files.
Guido van Rossum <guido@python.org>
parents:
11469
diff
changeset
|
119 #endif /* HAVE_DYNAMIC_LOADING */ |
