mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +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
|
@ -88,25 +88,6 @@ class select.kqueue "kqueue_queue_Object *" "_selectstate_global->kqueue_queue_T
|
|||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=41071028e0ede093]*/
|
||||
|
||||
static int
|
||||
fildes_converter(PyObject *o, void *p)
|
||||
{
|
||||
int fd;
|
||||
int *pointer = (int *)p;
|
||||
fd = PyObject_AsFileDescriptor(o);
|
||||
if (fd == -1)
|
||||
return 0;
|
||||
*pointer = fd;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*[python input]
|
||||
class fildes_converter(CConverter):
|
||||
type = 'int'
|
||||
converter = 'fildes_converter'
|
||||
[python start generated code]*/
|
||||
/*[python end generated code: output=da39a3ee5e6b4b0d input=ca54eb5aa476e20a]*/
|
||||
|
||||
/* list of Python objects and their file descriptor */
|
||||
typedef struct {
|
||||
PyObject *obj; /* owned reference */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue