Skip to content

Commit 92e3fde

Browse files
committed
Move PyNumber_AsOff_t after whence check
1 parent a21ef45 commit 92e3fde

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Modules/_io/bufferedio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,17 +1383,17 @@ _io__Buffered_seek_impl(buffered *self, PyObject *targetobj, int whence)
13831383
return NULL;
13841384
}
13851385

1386-
_PyIO_State *state = find_io_state_by_def(Py_TYPE(self));
1387-
if (_PyIOBase_check_seekable(state, self->raw, Py_True) == NULL) {
1388-
return NULL;
1389-
}
1390-
13911386
target = PyNumber_AsOff_t(targetobj, PyExc_ValueError);
13921387
if (target == -1 && PyErr_Occurred())
13931388
return NULL;
13941389

13951390
CHECK_CLOSED(self, "seek of closed file")
13961391

1392+
_PyIO_State *state = find_io_state_by_def(Py_TYPE(self));
1393+
if (_PyIOBase_check_seekable(state, self->raw, Py_True) == NULL) {
1394+
return NULL;
1395+
}
1396+
13971397
/* SEEK_SET and SEEK_CUR are special because we could seek inside the
13981398
buffer. Other whence values must be managed without this optimization.
13991399
Some Operating Systems can provide additional values, like

0 commit comments

Comments
 (0)