mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-41985: Add _PyLong_FileDescriptor_Converter and AC converter for "fildes". (GH-22620)
This commit is contained in:
parent
b2c0a43699
commit
9975cc5008
10 changed files with 61 additions and 94 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue