diff options
author | Brett Cannon <brett@python.org> | 2012-04-21 22:52:52 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-04-21 22:52:52 (GMT) |
commit | a64faf0771bceee789dd345202919147f595bfd3 (patch) | |
tree | 2a53ef6ed0455c8979351ee8e5fff6ce7d6331b9 /Python/import.c | |
parent | ea59dbff16e305aa07ef5896cc59fb36dc5edac3 (diff) | |
download | cpython-a64faf0771bceee789dd345202919147f595bfd3.zip cpython-a64faf0771bceee789dd345202919147f595bfd3.tar.gz cpython-a64faf0771bceee789dd345202919147f595bfd3.tar.bz2 |
Issue #13959: Re-implement imp.source_from_cache() in Lib/imp.py.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/Python/import.c b/Python/import.c index 7298ca5..bcf6bd7 100644 --- a/Python/import.c +++ b/Python/import.c @@ -2926,36 +2926,6 @@ PyDoc_STRVAR(doc_reload, Reload the module. The module must have been successfully imported before."); -static PyObject * -imp_source_from_cache(PyObject *self, PyObject *args, PyObject *kws) -{ - static char *kwlist[] = {"path", NULL}; - PyObject *pathname, *source; - - if (!PyArg_ParseTupleAndKeywords( - args, kws, "O&", kwlist, - PyUnicode_FSDecoder, &pathname)) - return NULL; - - source = make_source_pathname(pathname); - if (source == NULL) { - PyErr_Format(PyExc_ValueError, "Not a PEP 3147 pyc path: %R", - pathname); - Py_DECREF(pathname); - return NULL; - } - Py_DECREF(pathname); - return source; -} - -PyDoc_STRVAR(doc_source_from_cache, -"source_from_cache(path) -> path\n\ -Given the path to a .pyc./.pyo file, return the path to its .py file.\n\ -\n\ -The .pyc/.pyo file does not need to exist; this simply returns the path to\n\ -the .py file calculated to correspond to the .pyc/.pyo file. If path\n\ -does not conform to PEP 3147 format, ValueError will be raised."); - /* Doc strings */ PyDoc_STRVAR(doc_imp, @@ -3007,9 +2977,6 @@ static PyMethodDef imp_methods[] = { {"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}, - {"source_from_cache", (PyCFunction)imp_source_from_cache, - METH_VARARGS | METH_KEYWORDS, doc_source_from_cache}, - /* The rest are obsolete */ {"get_frozen_object", imp_get_frozen_object, METH_VARARGS}, {"is_frozen_package", imp_is_frozen_package, METH_VARARGS}, {"init_builtin", imp_init_builtin, METH_VARARGS}, |