r72371 - in python/branches/py3k/Modules: socketmodule.c socketmodule.h
Author: benjamin.peterson Date: Wed May 6 04:43:58 2009 New Revision: 72371 Log: turn this into a macro Modified: python/branches/py3k/Modules/socketmodule.c python/branches/py3k/Modules/socketmodule.h Modified: python/branches/py3k/Modules/socketmodule.c ============================================================================== --- python/branches/py3k/Modules/socketmodule.c (original) +++ python/branches/py3k/Modules/socketmodule.c Wed May 6 04:43:58 2009 @@ -4146,14 +4146,6 @@ NULL }; -PySocketModule_APIObject * -PySocketModule_ImportModuleAndAPI(void) -{ - void *api; - api = PyCapsule_Import(PySocket_CAPSULE_NAME, 1);; - return (PySocketModule_APIObject *)api; -} - /* Initialize the _socket module. Modified: python/branches/py3k/Modules/socketmodule.h ============================================================================== --- python/branches/py3k/Modules/socketmodule.h (original) +++ python/branches/py3k/Modules/socketmodule.h Wed May 6 04:43:58 2009 @@ -190,38 +190,9 @@ PyObject *error; } PySocketModule_APIObject; -/* XXX The net effect of the following appears to be to define a function - XXX named PySocketModule_APIObject in _ssl.c. It's unclear why it isn't - XXX defined there directly. +#define PySocketModule_ImportModuleAndAPI() PyCapsule_Import(PySocket_CAPSULE_NAME, 1) - >>> It's defined here because other modules might also want to use - >>> 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 +#ifdef __cpluplus } #endif #endif /* !Py__SOCKET_H */
I was cleaning out my python-checkins folder today, and came across this item that I seem to have saved for a rainy day. The last patched line looks like an inadvertent character delete (#ifdef __cplusplus -> #ifdef __cpluplus), and the typo still exists in my current py3k checkout. --David On Wed, 6 May 2009 at 04:43, benjamin.peterson wrote:
Author: benjamin.peterson Date: Wed May 6 04:43:58 2009 New Revision: 72371
Log: turn this into a macro
Modified: python/branches/py3k/Modules/socketmodule.c python/branches/py3k/Modules/socketmodule.h
Modified: python/branches/py3k/Modules/socketmodule.c ============================================================================== --- python/branches/py3k/Modules/socketmodule.c (original) +++ python/branches/py3k/Modules/socketmodule.c Wed May 6 04:43:58 2009 @@ -4146,14 +4146,6 @@ NULL };
-PySocketModule_APIObject * -PySocketModule_ImportModuleAndAPI(void) -{ - void *api; - api = PyCapsule_Import(PySocket_CAPSULE_NAME, 1);; - return (PySocketModule_APIObject *)api; -} -
/* Initialize the _socket module.
Modified: python/branches/py3k/Modules/socketmodule.h ============================================================================== --- python/branches/py3k/Modules/socketmodule.h (original) +++ python/branches/py3k/Modules/socketmodule.h Wed May 6 04:43:58 2009 @@ -190,38 +190,9 @@ PyObject *error; } PySocketModule_APIObject;
-/* XXX The net effect of the following appears to be to define a function - XXX named PySocketModule_APIObject in _ssl.c. It's unclear why it isn't - XXX defined there directly. +#define PySocketModule_ImportModuleAndAPI() PyCapsule_Import(PySocket_CAPSULE_NAME, 1)
- >>> It's defined here because other modules might also want to use - >>> 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 +#ifdef __cpluplus } #endif #endif /* !Py__SOCKET_H */ _______________________________________________ Python-checkins mailing list Python-checkins@python.org http://mail.python.org/mailman/listinfo/python-checkins
participants (2)
-
benjamin.peterson -
R. David Murray