summaryrefslogtreecommitdiffstats
path: root/Include/longobject.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-11-16 01:24:05 (GMT)
committerGuido van Rossum <guido@python.org>2007-11-16 01:24:05 (GMT)
commit39eb8fa0dbbcd6568fceb7ca59220aa3281e0cc4 (patch)
tree5fa187d82123d1055401cb9ae8a4dcd16928bfde /Include/longobject.h
parentdd9e3b8736fae1f730d027d5383a2b17c661ce82 (diff)
downloadcpython-39eb8fa0dbbcd6568fceb7ca59220aa3281e0cc4.zip
cpython-39eb8fa0dbbcd6568fceb7ca59220aa3281e0cc4.tar.gz
cpython-39eb8fa0dbbcd6568fceb7ca59220aa3281e0cc4.tar.bz2
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/longobject.h')
-rw-r--r--Include/longobject.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/Include/longobject.h b/Include/longobject.h
index 6bf3409..16abd0e 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];