summaryrefslogtreecommitdiff
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-11-16 01:24:05 +0000
committerGuido van Rossum <guido@python.org>2007-11-16 01:24:05 +0000
commit1bf9c6599f9b1baab0a36b3a678bd066bc60eadd (patch)
tree78077c580a305f755546561dd76eda08ae6ecb18 /Include
parent1e6afae53919575b3b0c131836696d96c735d638 (diff)
downloadcpython-1bf9c6599f9b1baab0a36b3a678bd066bc60eadd.tar.gz
This is roughly socket2.diff from issue 1378, with a few changes applied
to ssl.py (no need to test whether we can dup any more). Regular sockets no longer have a _base, but we still have explicit reference counting of socket objects for the benefit of makefile(); using duplicate sockets won't work for SSLSocket.
Diffstat (limited to 'Include')
-rw-r--r--Include/longobject.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/longobject.h b/Include/longobject.h
index 6bf3409611..16abd0e903 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -26,6 +26,15 @@ PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
+/* Used by socketmodule.c */
+#if SIZEOF_SOCKET_T <= SIZEOF_LONG
+#define PyLong_FromSocket_t(fd) PyLong_FromLong((SOCKET_T)(fd))
+#define PyLong_AsSocket_t(fd) (SOCKET_T)PyLong_AsLong(fd)
+#else
+#define PyLong_FromSocket_t(fd) PyLong_FromLongLong(((SOCKET_T)(fd));
+#define PyLong_AsSocket_t(fd) (SOCKET_T)PyLong_AsLongLong(fd)
+#endif
+
/* For use by intobject.c only */
PyAPI_DATA(int) _PyLong_DigitValue[256];