summaryrefslogtreecommitdiff
path: root/Modules/_io/winconsoleio.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_io/winconsoleio.c')
-rw-r--r--Modules/_io/winconsoleio.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c
index 1d169e2764..4d36bb5d2f 100644
--- a/Modules/_io/winconsoleio.c
+++ b/Modules/_io/winconsoleio.c
@@ -210,8 +210,8 @@ _io__WindowsConsoleIO_close_impl(winconsoleio *self)
PyObject *exc, *val, *tb;
int rc;
_Py_IDENTIFIER(close);
- res = _PyObject_CallMethodId((PyObject*)&PyRawIOBase_Type,
- &PyId_close, "O", self);
+ res = _PyObject_CallMethodIdObjArgs((PyObject*)&PyRawIOBase_Type,
+ &PyId_close, self, NULL);
if (!self->closehandle) {
self->handle = INVALID_HANDLE_VALUE;
return res;
@@ -318,11 +318,6 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
Py_CLEAR(decodedname);
if (name == NULL)
return -1;
- if (console_type == '\0') {
- PyErr_SetString(PyExc_ValueError,
- "Cannot open non-console file");
- return -1;
- }
if (wcslen(name) != length) {
PyMem_Free(name);
@@ -404,11 +399,6 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
if (console_type == '\0')
console_type = _get_console_type(self->handle);
- if (console_type == '\0') {
- PyErr_SetString(PyExc_ValueError,
- "Cannot open non-console file");
- goto error;
- }
if (self->writable && console_type != 'w') {
PyErr_SetString(PyExc_ValueError,
"Cannot open console input buffer for writing");