summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r--Python/_warnings.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index e78f216..d510381 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -214,7 +214,7 @@ get_warnings_attr(PyInterpreterState *interp, PyObject *attr, int try_import)
gone, then we can't even use PyImport_GetModule without triggering
an interpreter abort.
*/
- if (!interp->modules) {
+ if (!_PyImport_GetModules(interp)) {
return NULL;
}
warnings_module = PyImport_GetModule(&_Py_ID(warnings));
@@ -1050,7 +1050,6 @@ warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category,
static PyObject *
get_source_line(PyInterpreterState *interp, PyObject *module_globals, int lineno)
{
- PyObject *external;
PyObject *loader;
PyObject *module_name;
PyObject *get_source;
@@ -1059,13 +1058,7 @@ get_source_line(PyInterpreterState *interp, PyObject *module_globals, int lineno
PyObject *source_line;
/* stolen from import.c */
- external = PyObject_GetAttrString(interp->importlib, "_bootstrap_external");
- if (external == NULL) {
- return NULL;
- }
-
- loader = PyObject_CallMethod(external, "_bless_my_loader", "O", module_globals, NULL);
- Py_DECREF(external);
+ loader = _PyImport_BlessMyLoader(interp, module_globals);
if (loader == NULL) {
return NULL;
}