@@ -1202,32 +1202,52 @@ static PyMethodDef winconsoleio_methods[] = {
12021202
12031203/* 'closed' and 'mode' are attributes for compatibility with FileIO. */
12041204
1205+ /*[clinic input]
1206+ @getter
1207+ _io._WindowsConsoleIO.closed
1208+
1209+ True if the file is closed.
1210+ [clinic start generated code]*/
1211+
12051212static PyObject *
1206- get_closed (PyObject * op , void * Py_UNUSED (closure ))
1213+ _io__WindowsConsoleIO_closed_get_impl (winconsoleio * self )
1214+ /*[clinic end generated code: output=5a8df1a0e2bfa766 input=ece879e363f4d6bb]*/
12071215{
1208- winconsoleio * self = winconsoleio_CAST (op );
12091216 return PyBool_FromLong ((long )(self -> fd == -1 ));
12101217}
12111218
1219+ /*[clinic input]
1220+ @getter
1221+ _io._WindowsConsoleIO.closefd
1222+
1223+ True if the file descriptor will be closed by close().
1224+ [clinic start generated code]*/
1225+
12121226static PyObject *
1213- get_closefd (PyObject * op , void * Py_UNUSED (closure ))
1227+ _io__WindowsConsoleIO_closefd_get_impl (winconsoleio * self )
1228+ /*[clinic end generated code: output=e6a6c7bab25b18c9 input=155722042f7dcf53]*/
12141229{
1215- winconsoleio * self = winconsoleio_CAST (op );
12161230 return PyBool_FromLong ((long )(self -> closefd ));
12171231}
12181232
1233+ /*[clinic input]
1234+ @getter
1235+ _io._WindowsConsoleIO.mode
1236+
1237+ String giving the file mode.
1238+ [clinic start generated code]*/
1239+
12191240static PyObject *
1220- get_mode (PyObject * op , void * Py_UNUSED (closure ))
1241+ _io__WindowsConsoleIO_mode_get_impl (winconsoleio * self )
1242+ /*[clinic end generated code: output=2d7c4cabf96e5281 input=e1fa9cd881117c0f]*/
12211243{
1222- winconsoleio * self = winconsoleio_CAST (op );
12231244 return PyUnicode_FromString (self -> readable ? "rb" : "wb" );
12241245}
12251246
12261247static PyGetSetDef winconsoleio_getsetlist [] = {
1227- {"closed" , get_closed , NULL , "True if the file is closed" },
1228- {"closefd" , get_closefd , NULL ,
1229- "True if the file descriptor will be closed by close()." },
1230- {"mode" , get_mode , NULL , "String giving the file mode" },
1248+ _IO__WINDOWSCONSOLEIO_CLOSED_GETSETDEF
1249+ _IO__WINDOWSCONSOLEIO_CLOSEFD_GETSETDEF
1250+ _IO__WINDOWSCONSOLEIO_MODE_GETSETDEF
12311251 {NULL },
12321252};
12331253
0 commit comments