mirror of https://github.com/python/cpython
turn this into a macro
This commit is contained in:
parent
608d8bcdfc
commit
81c447f4d8
|
@ -4146,14 +4146,6 @@ PySocketModule_APIObject PySocketModuleAPI =
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PySocketModule_APIObject *
|
|
||||||
PySocketModule_ImportModuleAndAPI(void)
|
|
||||||
{
|
|
||||||
void *api;
|
|
||||||
api = PyCapsule_Import(PySocket_CAPSULE_NAME, 1);;
|
|
||||||
return (PySocketModule_APIObject *)api;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Initialize the _socket module.
|
/* Initialize the _socket module.
|
||||||
|
|
||||||
|
|
|
@ -190,38 +190,9 @@ typedef struct {
|
||||||
PyObject *error;
|
PyObject *error;
|
||||||
} PySocketModule_APIObject;
|
} PySocketModule_APIObject;
|
||||||
|
|
||||||
/* XXX The net effect of the following appears to be to define a function
|
#define PySocketModule_ImportModuleAndAPI() PyCapsule_Import(PySocket_CAPSULE_NAME, 1)
|
||||||
XXX named PySocketModule_APIObject in _ssl.c. It's unclear why it isn't
|
|
||||||
XXX defined there directly.
|
|
||||||
|
|
||||||
>>> It's defined here because other modules might also want to use
|
#ifdef __cpluplus
|
||||||
>>> the C API.
|
|
||||||
|
|
||||||
*/
|
|
||||||
#ifndef PySocket_BUILDING_SOCKET
|
|
||||||
|
|
||||||
/* --- C API ----------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Interfacestructure to C API for other modules.
|
|
||||||
Call PySocketModule_ImportModuleAndAPI() to initialize this
|
|
||||||
structure. After that usage is simple:
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O!|zz:ssl",
|
|
||||||
&PySocketModule.Sock_Type, (PyObject*)&Sock,
|
|
||||||
&key_file, &cert_file))
|
|
||||||
return NULL;
|
|
||||||
...
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* You *must* call this before using any of the functions in
|
|
||||||
PySocketModule and check its outcome; otherwise all accesses will
|
|
||||||
result in a segfault. Returns 0 on success. */
|
|
||||||
|
|
||||||
PyAPI_FUNC(PySocketModule_APIObject *) PySocketModule_ImportModuleAndAPI(void);
|
|
||||||
|
|
||||||
#endif /* !PySocket_BUILDING_SOCKET */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* !Py__SOCKET_H */
|
#endif /* !Py__SOCKET_H */
|
||||||
|
|
Loading…
Reference in New Issue