Bug#680971: python3-apt: apt_inst.TarFile.extractdata could accepts bytes
* Julian Andres Klode <jak@debian.org>, 2013-08-26, 13:48:
The apt_inst.TarFile.extractdata method requires that it's argument is
a str. It would be nice if it also accepted bytes objects. This would
be consistent with e.g. built-in open function, which accepts one or
the other as filename.
Thank you for your bug report; and yes, you're right. We are using
PyArg_ParseTuple() to parse the string. We currently use the format
string "s" for parsing file names. If you happen to know the best
format string we could use that accepts bytes strings as well, please
let us know. It has to work with Python 2.7 as well.
The documentation for the "s" format reads: "This format does not accept
bytes-like objects. If you want to accept filesystem paths and convert
them to C character strings, it is preferable to use the O& format with
PyUnicode_FSConverter() as converter."
PyUnicode_FSConverter is not available in Python 2.X, though.
--
Jakub Wilk
Reply to: