New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[py3k] tell() fails in some situation #47825
Comments
Hello. I noticed test_mailbox (test_add) fails on my win2k machine. ====================================================================== Traceback (most recent call last):
File "test_mailbox.py", line 60, in tearDown
self._box.close()
File "e:\python-dev\py3k\lib\mailbox.py", line 642, in close
self.flush()
File "e:\python-dev\py3k\lib\mailbox.py", line 600, in flush
stop - self._file.tell()))
File "e:\python-dev\py3k\lib\io.py", line 1625, in tell
chars_decoded += len(decoder.decode(next_byte))
File "e:\python-dev\py3k\lib\io.py", line 1295, in decode
output = self.decoder.decode(input, final=final)
TypeError: decode() argument 1 must be string or pinned buffer, not
bytearray And this is simple reproducable code. ("a.txt" contains some text) f = open("a.txt")
f.read(1)
f.tell() # boom I searched the place where raises this error in C code, if (!PyArg_ParseTupleAndKeywords(args, kwargs, "t#|i:decode",
incrementalkwarglist, &data, &size, &final))
return NULL; This uses "t#", so cannot accept bytearray, probably. |
Your patch looks right to me. It should also be backported to 2.6. |
Well, MultibyteCodec_Decode() also uses Py_buffer in py3k but not in |
Le dimanche 17 août 2008 à 11:44 +0000, Hirokazu Yamamoto a écrit :
It should be :-) |
OK, done. |
Please state the revision numbers when closing an issue due to a commit; |
Sorry, fixed in r65760 and r65762. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: