Message72757
I'm not sure. I've never done anything with the io module. Simply
eliminating the bytes checks and letting it try to write the string
yields:
File "/Users/skip/local/lib/python3.0/dbm/dumb.py", line 170, in
__setitem__
self._addkey(key, self._addval(val))
File "/Users/skip/local/lib/python3.0/dbm/dumb.py", line 138, in
_addval
f.write(val)
File "/Users/skip/local/lib/python3.0/io.py", line 1224, in write
return BufferedWriter.write(self, b)
File "/Users/skip/local/lib/python3.0/io.py", line 1034, in write
raise TypeError("can't write str to binary stream")
I suppose you'd have to check if val is an instance of str and if so,
encode it as utf-8. I notice in the existing code that it's doing
some key decoding assuming latin-1. That would be an incompatibility,
but I think assuming latin-1 is wrong.
That said, I've attached a patch which passes all current unit tests.
Skip |
|
Date |
User |
Action |
Args |
2008-09-08 00:26:16 | skip.montanaro | set | recipients:
+ skip.montanaro, gvanrossum |
2008-09-08 00:26:16 | skip.montanaro | set | messageid: <1220833576.66.0.821569313311.issue3799@psf.upfronthosting.co.za> |
2008-09-08 00:26:15 | skip.montanaro | link | issue3799 messages |
2008-09-08 00:26:14 | skip.montanaro | create | |
|