bpo-41985: Add _PyLong_FileDescriptor_Converter and AC converter for "fildes". (GH-22620)

This commit is contained in:
Serhiy Storchaka 2020-10-09 23:00:45 +03:00 committed by GitHub
parent b2c0a43699
commit 9975cc5008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 61 additions and 94 deletions

View file

@ -223,6 +223,17 @@ PyObject_AsFileDescriptor(PyObject *o)
return fd;
}
int
_PyLong_FileDescriptor_Converter(PyObject *o, void *ptr)
{
int fd = PyObject_AsFileDescriptor(o);
if (fd == -1) {
return 0;
}
*(int *)ptr = fd;
return 1;
}
/*
** Py_UniversalNewlineFgets is an fgets variation that understands
** all of \r, \n and \r\n conventions.