Skip to content

Commit c52559b

Browse files
committed
PEP 7 fixes; simplify some comments
1 parent 98bc865 commit c52559b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Modules/_io/textio.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ struct textio
673673
int detached;
674674
Py_ssize_t chunk_size;
675675
/* Use helpers _textiowrapper_buffer_* to access buffer; many
676-
operations can set it to NULL (ref: gh-143008, gh-142594). */
676+
operations can set it to NULL (see gh-143008, gh-142594). */
677677
PyObject *buffer;
678678
PyObject *encoding;
679679
PyObject *encoder;
@@ -734,20 +734,22 @@ struct textio
734734
/* Helpers to safely operate on self->buffer.
735735
736736
self->buffer can be detached (set to NULL) by any user code that is called
737-
leading to NULL pointer dereferences (ex. gh-143008, gh-142594). Protect against
737+
leading to NULL pointer dereferences (see gh-143008, gh-142594). Protect against
738738
that by using helpers to check self->buffer validity at callsites. */
739739
static PyObject *
740740
_textiowrapper_buffer_safe(textio *self) {
741741
/* Check self->buffer directly but match errors of CHECK_ATTACHED since this
742742
is called during construction and destruction where self->ok which
743743
CHECK_ATTACHED uses does not imply self->buffer state. */
744744
if (self->buffer == NULL) {
745-
if (self->ok <= 0)
745+
if (self->ok <= 0) {
746746
PyErr_SetString(PyExc_ValueError,
747747
"I/O operation on uninitialized object");
748-
else
748+
}
749+
else {
749750
PyErr_SetString(PyExc_ValueError,
750751
"underlying buffer has been detached");
752+
}
751753
return NULL;
752754
}
753755
return self->buffer;

0 commit comments

Comments
 (0)