Skip Montanaro <[EMAIL PROTECTED]> added the comment: 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 ---------- keywords: +patch Added file: http://bugs.python.org/file11418/dumb.diff _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3799> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com