New submission from Hirokazu Yamamoto <[EMAIL PROTECTED]>:

Hello. I noticed test_mailbox (test_add) fails on my win2k machine.
It's something like this.

======================================================================
ERROR: test_add (__main__.TestMbox)
----------------------------------------------------------------------
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,
and I found mbidecoder_decode() is.

    if (!PyArg_ParseTupleAndKeywords(args, kwargs, "t#|i:decode",
                incrementalkwarglist, &data, &size, &final))
        return NULL;

This uses "t#", so cannot accept bytearray, probably.
I hope attached file solves this issue. Thank you.

----------
files: fix_mbidecoder_decode.patch
keywords: patch
messages: 71262
nosy: ocean-city
severity: normal
status: open
title: [py3k] tell() fails in some situation
versions: Python 3.0
Added file: http://bugs.python.org/file11135/fix_mbidecoder_decode.patch

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3575>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to