summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:50 -0800
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:50 -0800
commit3b0e4320092ac0504b6670cafaf0301b908c91fc (patch)
treed3be1b6b844d61763bb366fa21ceed475e5703fd /Python/import.c
parentb2fa705fd3887c326e811c418469c784353027f4 (diff)
parentf687fbcd73c14dfcbe086eb5cd94b298f1e81e72 (diff)
downloadcpython-3b0e4320092ac0504b6670cafaf0301b908c91fc.tar.gz
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/Python/import.c b/Python/import.c
index cd865a5423..53c0f4defb 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -260,8 +260,7 @@ _imp_acquire_lock_impl(PyObject *module)
#ifdef WITH_THREAD
_PyImport_AcquireLock();
#endif
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
/*[clinic input]
@@ -283,8 +282,7 @@ _imp_release_lock_impl(PyObject *module)
return NULL;
}
#endif
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
void
@@ -1035,7 +1033,7 @@ _imp_create_builtin(PyObject *module, PyObject *spec)
{
struct _inittab *p;
PyObject *name;
- char *namestr;
+ const char *namestr;
PyObject *mod;
name = PyObject_GetAttrString(spec, "name");
@@ -1705,7 +1703,7 @@ PyImport_ReloadModule(PyObject *m)
Py_INCREF(imp);
}
- reloaded_module = _PyObject_CallMethodId(imp, &PyId_reload, "O", m);
+ reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL);
Py_DECREF(imp);
return reloaded_module;
}
@@ -1853,8 +1851,7 @@ _imp_init_frozen_impl(PyObject *module, PyObject *name)
if (ret < 0)
return NULL;
if (ret == 0) {
- Py_INCREF(Py_None);
- return Py_None;
+ Py_RETURN_NONE;
}
m = PyImport_AddModuleObject(name);
Py_XINCREF(m);
@@ -2045,11 +2042,6 @@ _imp_exec_builtin_impl(PyObject *module, PyObject *mod)
return exec_builtin_or_dynamic(mod);
}
-/*[clinic input]
-dump buffer
-[clinic start generated code]*/
-/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/
-
PyDoc_STRVAR(doc_imp,
"(Extremely) low-level import machinery bits as used by importlib and imp.");