Christian Heimes wrote:
> What do you think about
>
> def write(self, s: str):
> if self.closed:
> raise ValueError("write to closed file")
> try:
> b = s.encode(self._encoding)
> except AttributeError:
> raise TypeError("str expected
On 17/07/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
>def write(self, s: str):
>if self.closed:
>raise ValueError("write to closed file")
>if not hasattr(s, 'encode')
>raise TypeError("str expected, got %r" % s)
>...
>
> ? It explains what is
Guido van Rossum wrote:
> I came across this in your SF patch. I disagree with your desire to
> let TextIOWrapper.write() handle bytes: it should *only* be passed str
> objects. The uu test was failing because it was writing bytes to a
> text stream.
>
> Perhaps the error should be better; though
On 7/14/07, Christian Heimes <[EMAIL PROTECTED]> wrote:
> I'm having some troubles with unit tests in the py3k-struni branch. Some
> test like test_uu are failing because an io.TextIOWrapper instance's
> write() method doesn't handle bytes. The method is defined as:
>
> def write(self, s: str):
Hello!
I'm having some troubles with unit tests in the py3k-struni branch. Some
test like test_uu are failing because an io.TextIOWrapper instance's
write() method doesn't handle bytes. The method is defined as:
def write(self, s: str):
if self.closed:
raise ValueError("wr