mirror of
https://github.com/python/cpython.git
synced 2026-04-14 15:50:50 +00:00
[3.14] gh-144380: Fix incorrect type check in buffered_iternext() (GH-144381) (#144389)
gh-144380: Fix incorrect type check in `buffered_iternext()` (GH-144381)
(cherry picked from commit 40d07cad38)
Co-authored-by: Ruiyang Ke <me@ry.ke>
This commit is contained in:
parent
c766dda80d
commit
343679ee6a
2 changed files with 3 additions and 2 deletions
|
|
@ -0,0 +1 @@
|
|||
Improve performance of :class:`io.BufferedReader` line iteration by ~49%.
|
||||
|
|
@ -1493,8 +1493,8 @@ buffered_iternext(PyObject *op)
|
|||
|
||||
_PyIO_State *state = find_io_state_by_def(Py_TYPE(self));
|
||||
tp = Py_TYPE(self);
|
||||
if (Py_IS_TYPE(tp, state->PyBufferedReader_Type) ||
|
||||
Py_IS_TYPE(tp, state->PyBufferedRandom_Type))
|
||||
if (tp == state->PyBufferedReader_Type ||
|
||||
tp == state->PyBufferedRandom_Type)
|
||||
{
|
||||
/* Skip method call overhead for speed */
|
||||
line = _buffered_readline(self, -1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue