New submission from Antony Lee: The docs of pkgutil.get_data say "The resource argument should be in the form of a relative filename, using / as the path separator. The parent directory name .. is not allowed, and nor is a rooted name (starting with a /)."
In fact (on Python 3.5 at least): * pkgutil.get_data("logging", "/__init__.py") works, but simply chops off the first slash, returning the contents of the stdlib's logging/__init__.py. * pkgutil.get_data("logging", "../re.py") works, returning the contents of the stdlib's re.py. People who actually thought about the implications of get_data/zipimport/etc. can decide whether to remove this functionality or to update the docs, I'm just reporting it. Also, it would be nice if get_data gained a "text mode" (i.e. returning str instead of bytes and with support for universal newlines). ---------- components: Library (Lib) messages: 252450 nosy: Antony.Lee priority: normal severity: normal status: open title: Two issues with pkgutil.get_data versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25330> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com