diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-07 17:13:09 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-07 17:13:09 (GMT) |
commit | 13a7a21258f0cd241c2cf1367a954d6742daa2a6 (patch) | |
tree | 4c49495d5dfb4b591d2a93e9f2567b4f2ba70f49 /Python | |
parent | 8de8e03849ecbb08da6deb4679d08c0206b71316 (diff) | |
download | cpython-13a7a21258f0cd241c2cf1367a954d6742daa2a6.zip cpython-13a7a21258f0cd241c2cf1367a954d6742daa2a6.tar.gz cpython-13a7a21258f0cd241c2cf1367a954d6742daa2a6.tar.bz2 |
Issue #1762972: Readded the reload() function as imp.reload()
Diffstat (limited to 'Python')
-rw-r--r-- | Python/import.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c index 658cc70..07bcbbf 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2931,6 +2931,17 @@ imp_new_module(PyObject *self, PyObject *args) return PyModule_New(name); } +static PyObject * +imp_reload(PyObject *self, PyObject *v) +{ + return PyImport_ReloadModule(v); +} + +PyDoc_STRVAR(doc_reload, +"reload(module) -> module\n\ +\n\ +Reload the module. The module must have been successfully imported before."); + /* Doc strings */ PyDoc_STRVAR(doc_imp, @@ -2989,6 +3000,7 @@ static PyMethodDef imp_methods[] = { {"lock_held", imp_lock_held, METH_NOARGS, doc_lock_held}, {"acquire_lock", imp_acquire_lock, METH_NOARGS, doc_acquire_lock}, {"release_lock", imp_release_lock, METH_NOARGS, doc_release_lock}, + {"reload", imp_reload, METH_O, doc_reload}, /* The rest are obsolete */ {"get_frozen_object", imp_get_frozen_object, METH_VARARGS}, {"init_builtin", imp_init_builtin, METH_VARARGS}, |