Inada Naoki <songofaca...@gmail.com> added the comment:

You are right. I misunderstood.

```
        if (PyUnicode_IS_ASCII(text) &&
              (PyUnicode_GET_LENGTH(text) +
                (self->pending_bytes ? self->pending_bytes_count : 0)) <=
                  self->chunk_size &&
              is_asciicompat_encoding(self->encodefunc)) {
            b = text;
            Py_INCREF(b);
        }
```

This seems too complex and defensive.  Isn't `PyUnicode_GET_LENGTH(text) < 
self->chunk_size` enough?

When `PyUnicode_GET_LENGTH(text) + self->pending_bytes_count > 
self->chunk_size`, `self->pending_bytes` is preflushed anyway.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43260>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to