mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
Issue #4835: make PyLong_FromSocket_t() and PyLong_AsSocket_t() private
to the socket module, and fix the width of socket descriptors to be correctly detected under 64-bit Windows.
This commit is contained in:
parent
1a9a9d5433
commit
67c7ce4bef
3 changed files with 12 additions and 9 deletions
|
|
@ -32,15 +32,6 @@ PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
|
||||||
cleanup to keep the extra information. [CH] */
|
cleanup to keep the extra information. [CH] */
|
||||||
#define PyLong_AS_LONG(op) PyLong_AsLong(op)
|
#define PyLong_AS_LONG(op) PyLong_AsLong(op)
|
||||||
|
|
||||||
/* 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
|
|
||||||
|
|
||||||
/* Issue #1983: pid_t can be longer than a C long on some systems */
|
/* Issue #1983: pid_t can be longer than a C long on some systems */
|
||||||
#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT
|
#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT
|
||||||
#define _Py_PARSE_PID "i"
|
#define _Py_PARSE_PID "i"
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,10 @@ Core and Builtins
|
||||||
Extensions
|
Extensions
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
- Issue #4835: make PyLong_FromSocket_t() and PyLong_AsSocket_t() private
|
||||||
|
to the socket module, and fix the width of socket descriptors to be
|
||||||
|
correctly detected under 64-bit Windows.
|
||||||
|
|
||||||
- Issue #1027206: Support IDNA in gethostbyname, gethostbyname_ex,
|
- Issue #1027206: Support IDNA in gethostbyname, gethostbyname_ex,
|
||||||
getaddrinfo and gethostbyaddr. getnameinfo is now restricted to numeric
|
getaddrinfo and gethostbyaddr. getnameinfo is now restricted to numeric
|
||||||
addresses as input.
|
addresses as input.
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,14 @@ typedef int SOCKET_T;
|
||||||
# define SIZEOF_SOCKET_T SIZEOF_INT
|
# define SIZEOF_SOCKET_T SIZEOF_INT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
/* Socket address */
|
/* Socket address */
|
||||||
typedef union sock_addr {
|
typedef union sock_addr {
|
||||||
struct sockaddr_in in;
|
struct sockaddr_in in;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue