Author Antony.Lee
Recipients Antony.Lee
Date 2015-10-07.03:06:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1444187174.4.0.432847594977.issue25330@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2015-10-07 03:06:14Antony.Leesetrecipients: + Antony.Lee
2015-10-07 03:06:14Antony.Leesetmessageid: <1444187174.4.0.432847594977.issue25330@psf.upfronthosting.co.za>
2015-10-07 03:06:14Antony.Leelinkissue25330 messages
2015-10-07 03:06:13Antony.Leecreate