[Python-3000] issue 3187 and decoding filenames
Victor Stinner
victor.stinner at haypocalc.com
Thu Aug 21 17:01:38 CEST 2008
Le Thursday 21 August 2008 15:30:22 Benjamin Peterson, vous avez écrit :
> Issue 3187 is a case where os.listdir tries to decode filenames with
> the default file system encoding, but failing that, simply returns the
> unencoded bytestring. This was obviously ok in 2.x, but not so good in
> py3k where bytes are cleanly separated from unicode.
I'm trying to write a workaround in Python, but I'm unable to write my own
class which is compatible with "buffer interface"... What is this interface?
It works with bytes, but I don't want to inherit bytes (nor str).
class MyBuffer(bytes):
def __new__(self, data):
obj = bytes.__new__(self, data)
obj.myattribute = 42
return obj
--
Victor Stinner aka haypo
http://www.haypocalc.com/blog/
More information about the Python-3000
mailing list